Bug 8585 : Add System Preference to specify Holds to Pull List Start Date
[koha.git] / installer / data / mysql / updatedatabase.pl
index ec1e73c..63b8803 100755 (executable)
@@ -5617,7 +5617,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
 
     $dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'");
     print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n";
-
     SetVersion($DBversion);
 }
 
@@ -5769,7 +5768,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
-
 $DBversion = '3.09.00.044';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");
@@ -5859,7 +5857,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion($DBversion);
 }
 
-$DBversion = "XXX";
+$DBversion = "3.09.00.051";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("
         CREATE TABLE aqinvoices (
@@ -5918,6 +5916,91 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.09.00.052";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('decreaseLoanHighHolds', NULL, '', 'Decreases the loan period for items with number of holds above the threshold specified in decreaseLoanHighHoldsValue', 'YesNo');");
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('decreaseLoanHighHoldsValue', NULL, '', 'Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)', 'Integer');");
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('decreaseLoanHighHoldsDuration', NULL, '', 'Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds', 'Integer');");
+    print "Upgrade to $DBversion done (Add systempreferences to decrease loan length on high demand items decreaseLoanHighHolds, decreaseLoanHighHoldsValue and decreaseLoanHighHoldsDuration) \n";
+    SetVersion ($DBversion);
+}
+
+
+$DBversion = "3.09.00.053";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(
+    q|CREATE TABLE `import_auths` (
+        import_record_id int(11) NOT NULL,
+        matched_authid int(11) default NULL,
+        control_number varchar(25) default NULL,
+        authorized_heading varchar(128) default NULL,
+        original_source varchar(25) default NULL,
+        CONSTRAINT import_auths_ibfk_1 FOREIGN KEY (import_record_id)
+        REFERENCES import_records (import_record_id) ON DELETE CASCADE ON UPDATE CASCADE,
+        KEY matched_authid (matched_authid)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;|
+    );
+    $dbh->do("ALTER TABLE import_batches
+                CHANGE COLUMN num_biblios num_records int(11) NOT NULL default 0,
+                ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'");
+    $dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN
+                (SELECT import_batch_id FROM import_records WHERE record_type='auth')");
+    
+    print "Upgrade to $DBversion done (Added support for staging authorities)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.054";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
+    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.055";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
+    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.056";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo')");
+    print "Upgrade to $DBversion done (Add system preference AuthDisplayHierarchy)\n";
+    SetVersion($DBversion);
+}
+
+
+$DBversion = "3.09.00.057";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqbasket ADD deliveryplace VARCHAR(10) default NULL AFTER basketgroupid;");
+    $dbh->do("ALTER TABLE aqbasket ADD billingplace VARCHAR(10) default NULL AFTER deliveryplace;");
+    print "Upgrade to $DBversion done (Bug 5356: Added billingplace, deliveryplace to the aqbasket table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.058";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidyoumean',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free');");
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free');");
+    print "Upgrade to $DBversion done (Add Did You Mean? configuration)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.059";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');");
+    print "Upgrade to $DBversion done (Add system preference BlockReturnOfWithdrawnItems)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer')");
+    print "Upgrade to $DBversion done (Added HoldsToPullStartDate syspref)\n";
+    SetVersion($DBversion);
+}
 
 =head1 FUNCTIONS