Bug 5795 Update the database as follow-up If sys pref
[koha.git] / installer / data / mysql / updatedatabase.pl
index 035e1e6..fcf904e 100755 (executable)
@@ -5239,6 +5239,60 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.09.00.004";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO permissions (module_bit, code, description) VALUES('13', 'edit_patrons', 'Perform batch modifivation of patrons')");
+    print "Upgrade to $DBversion done (Adds permissions flag for access to the patron modifications tool)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.005";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    unless (TableExists('quotes')) {
+        $dbh->do( qq{
+            CREATE TABLE `quotes` (
+              `id` int(11) NOT NULL AUTO_INCREMENT,
+              `source` text DEFAULT NULL,
+              `text` mediumtext NOT NULL,
+              `timestamp` datetime NOT NULL,
+              PRIMARY KEY (`id`)
+            ) ENGINE=InnoDB DEFAULT CHARSET=utf8
+        });
+    }
+    $dbh->do( qq{
+        INSERT IGNORE INTO permissions VALUES (13, "edit_quotes","Edit quotes for quote-of-the-day feature");
+    });
+    $dbh->do( qq{
+        INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('QuoteOfTheDay',0,'Enable or disable display of Quote of the Day on the OPAC home page',NULL,'YesNo');
+    });
+    print "Upgrade to $DBversion done (Adding Quote of the Day Option.)\n";
+    SetVersion($DBversion);
+}
+
+
+
+$DBversion = "3.09.00.006";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("UPDATE systempreferences SET
+                variable = 'OPACShowHoldQueueDetails',
+                value = CASE value WHEN '1' THEN 'priority' ELSE 'none' END,
+                options = 'none|priority|holds|holds_priority',
+                explanation = 'Show holds details in OPAC',
+                type = 'Choice'
+              WHERE variable = 'OPACDisplayRequestPriority'");
+    print "Upgrade to $DBversion done (Changed system preference OPACDisplayRequestPriority -> OPACShowHoldQueueDetails)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    unless(C4::Context->preference('ReservesControlBranch')){
+        $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights.','Choice')");
+}
+    print "Upgrade to $DBversion done (Insert ReservesControlBranch systempreference into systempreferences table )\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)