Bug 16371: (follow-up) DB changes
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:28:24 +0000 (10:28 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:28:26 +0000 (10:28 +0200)
We need to keep "opac" is the pref was set before the upgrade

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

installer/data/mysql/updatedatabase.pl

index d2bd7cb..6c335c2 100755 (executable)
@@ -22576,15 +22576,17 @@ if( CheckVersion( $DBversion ) ) {
 $DBversion = '20.06.00.023';
 if( CheckVersion( $DBversion ) ) {
 
+    my $QuoteOfTheDay = C4::Context->preference('QuoteOfTheDay');
     $dbh->do( q|
         UPDATE systempreferences
-        SET value = '',
-            options = 'intranet,opac',
+        SET options = 'intranet,opac',
             explanation = 'Enable or disable display of Quote of the Day on the OPAC and staff interface home page',
             type = 'multiple'
         WHERE variable = 'QuoteOfTheDay'
     | );
 
+    C4::Context->set_preference('QuoteOfTheDay', $QuoteOfTheDay ? 'opac' : '');
+
     NewVersion( $DBversion, 16371, "Quote of the Day (QOTD) for the staff interface " );
 }