8263 Make OPAC stylesheet preferences more consistent (dbrev)
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 18 Jun 2012 11:53:59 +0000 (13:53 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 3 Aug 2012 10:03:25 +0000 (12:03 +0200)
This patch handles the dbrev for this report. It optionally saves the value of the former opacstylesheet pref into opaclayoutstylesheet.

June 21, 2012 & July 4, 2012: Rebased.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
installer/data/mysql/updatedatabase.pl

index 3f817a2..14187d0 100755 (executable)
@@ -5621,6 +5621,20 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion ="3.09.00.XXX";
+if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    my $query = "SELECT value FROM systempreferences WHERE variable='opacstylesheet'";
+    my $remote= $dbh->selectrow_arrayref($query);
+    $dbh->do("DELETE from systempreferences WHERE variable='opacstylesheet'");
+    if($remote && $remote->[0]) {
+        $query="UPDATE systempreferences SET value=? WHERE variable='opaclayoutstylesheet'";
+        $dbh->do($query,undef,$remote->[0]);
+        print "NOTE: The URL of your remote opac css file has been moved to preference opaclayoutstylesheet.\n";
+    }
+    print "Upgrade to $DBversion done (BZ 8263: Make OPAC stylesheet preferences more consistent)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)