From 38d0b4078e69506a648912f14a9e4f658eb6abdc Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Mon, 29 Dec 2008 13:37:24 -0600 Subject: [PATCH] Bug 2578: remove unwanted intranetuserjs syspref - Database revision 3.01.00.011 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. Signed-off-by: Galen Charlton --- installer/data/mysql/updatedatabase.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 793f199642..dc8a610ab6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2128,6 +2128,25 @@ if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { $dbh->do("ALTER TABLE `borrower_attributes` MODIFY COLUMN `attribute` VARCHAR(64) DEFAULT NULL"); $dbh->do("ALTER TABLE `borrower_attributes` MODIFY COLUMN `password` VARCHAR(64) DEFAULT NULL"); print "Upgrade to $DBversion done (bug 2687: increase length of borrower attribute fields)\n"; + SetVersion ($DBversion); +} + +$DBversion = '3.01.00.011'; +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); } -- 2.39.5