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 |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl 
b/installer/data/mysql/updatedatabase.pl
index 5a2209e..6cea006 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2123,6 +2123,25 @@ if (C4::Context->preference("Version") < 
TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.010';
+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)
 
   Drop all foreign keys of the table $table
-- 
1.5.6

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to