[Koha-patches] [PATCH] Bug 2578: remove unwanted intranetuserjs syspref - Database revision 3.01.00.009

Andrew Moore andrew.moore at liblime.com
Thu Dec 18 17:59:32 CET 2008


The default syspref setting for intranetuserjs should be empty. At one
time, an unwanted value accidently got put in there. This removes the
syspref only if it equals the unwanted value.
---
 installer/data/mysql/updatedatabase.pl |   18 ++++++++++++++++++
 kohaversion.pl                         |    2 +-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index ba53391..bcb0d9d 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2113,6 +2113,24 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.009';
+if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) {
+
+    # Yes, the old value was ^M terminated.
+    my $bad_value = "function prepareEmailPopup(){\r\n  if (!document.getElementById) return false;\r\n  if (!document.getElementById('reserveemail')) return false;\r\n  rsvlink = document.getElementById('reserveemail');\r\n  rsvlink.onclick = function() {\r\n      doReservePopup();\r\n      return false;\r\n	}\r\n}\r\n\r\nfunction doReservePopup(){\r\n}\r\n\r\nfunction prepareReserveList(){\r\n}\r\n\r\naddLoadEvent(prepareEmailPopup);\r\naddLoadEvent(prepareReserveList);";
+
+    my $intranetuserjs = C4::Context->preference('intranetuserjs');
+    if ( $intranetuserjs eq $bad_value ) {
+        my $sql = <<'END_SQL';
+UPDATE systempreferences
+SET value = ''
+WHERE variable = 'intranetuserjs'
+END_SQL
+        $dbh->do($sql);
+    }
+    print "Upgrade to $DBversion done (removed bogus intranetuserjs syspref)\n";
+    SetVersion($DBversion);
+}
 
 =item DropAllForeignKeys($table)
 
diff --git a/kohaversion.pl b/kohaversion.pl
index 9baede2..510a3c3 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.008';
+    our $VERSION = '3.01.00.009';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.6




More information about the Koha-patches mailing list