Bumping database version
[koha_fer] / installer / data / mysql / updatedatabase.pl
index e9da578..c9f0d13 100755 (executable)
@@ -37,6 +37,7 @@ use Getopt::Long;
 # Koha modules
 use C4::Context;
 use C4::Installer;
+use C4::Dates;
 
 use MARC::Record;
 use MARC::File::XML ( BinaryEncoding => 'utf8' );
@@ -4068,7 +4069,126 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.03.00.024';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('TraceCompleteSubfields','0','Force subject tracings to only match complete subfields.','0','YesNo')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('UseAuthoritiesForTracings','1','Use authority record numbers for subject tracings instead of heading strings.','0','YesNo')");
+    print "Upgrade to $DBversion done (Add syspref to force whole-subfield matching on subject tracings)\n";
+    SetVersion($DBversion);
+};
+
+$DBversion = "3.03.00.025";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAllowUserToChooseBranch', 1, 'Allow the user to choose the branch they want to pickup their hold from','1','YesNo')");
+    print "Upgrade to $DBversion done (Add syspref to control if user can choose pickup branch for holds)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.026';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("UPDATE `message_attributes` SET message_name='Item Due' WHERE message_attribute_id=1 AND message_name LIKE 'Item DUE'");
+       print "Upgrade to $DBversion done ( fix capitalization in message type )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.027'; 
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('displayFacetCount', '0', NULL, NULL, 'YesNo')");
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('maxRecordsForFacets', '20', NULL, NULL, 'Integer')");
+    print "Upgrade to $DBversion done (Preferences for facet count)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.03.00.028";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('FacetLabelTruncationLength', 20, 'Truncate facets length to','','free')");
+    print "Upgrade to $DBversion done (Add FacetLabelTruncationLength syspref to control facets displayed length)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.03.00.029";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowPurchaseSuggestionBranchChoice', 0, 'Allow user to choose branch when making a purchase suggestion','1','YesNo')");
+    print "Upgrade to $DBversion done (Add syspref to control if user can choose branch when making purchase suggestion)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.03.00.030";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the OPAC','','free')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetFavicon','','Enter a complete URL to an image to replace the default Koha favicon on the Staff client','','free')");
+    print "Upgrade to $DBversion done (Add sysprefs to control custom favicons)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.03.00.031";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FineNotifyAtCheckin',0,'If ON notify librarians of overdue fines on the items they are checking in.',NULL,'YesNo');");
+    print "Upgrade to $DBversion done (Add syspref FineNotifyAtCheckin)\n";
+    SetVersion ($DBversion);    
+}
+
+$DBversion = '3.03.00.032';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('TraceSubjectSubdivisions', 1, 'Create searches on all subdivisions for subject tracings.','1','YesNo')");
+    print "Upgrade to $DBversion done ( include subdivisions when generating subject tracing searches )\n";
+    SetVersion ($DBversion);
+}
 
+$DBversion = '3.03.00.033';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('StaffAuthorisedValueImages', '1', '', NULL, 'YesNo')");
+    print "Upgrade to $DBversion done (System pref StaffAuthorisedValueImages)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.034';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `categories` ADD `hidelostitems` tinyint(1) NOT NULL default '0' AFTER `reservefee`");
+    print "Upgrade to $DBversion done (Add hidelostitems preference to borrower categories)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.035';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `issuingrules` ADD hardduedate date default NULL AFTER issuelength");
+    $dbh->do("ALTER TABLE `issuingrules` ADD hardduedatecompare tinyint NOT NULL default 0 AFTER hardduedate");
+    my $duedate;
+    if (C4::Context->preference("globalDueDate")) {
+      $duedate = C4::Dates::format_date_in_iso(C4::Context->preference("globalDueDate"));
+      $dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = 0");
+    } elsif (C4::Context->preference("ceilingDueDate")) {
+      $duedate = C4::Dates::format_date_in_iso(C4::Context->preference("ceilingDueDate"));
+      $dbh->do("UPDATE `issuingrules` SET hardduedate = '$duedate', hardduedatecompare = -1");
+    }
+    $dbh->do("DELETE FROM `systempreferences` WHERE variable = 'globalDueDate' OR variable = 'ceilingDueDate'");
+    print "Upgrade to $DBversion done (Move global and ceiling due dates to Circ Rules level)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.036';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('COinSinOPACResults', 1, 'If ON, use COinS in OPAC search results page.  NOTE: this can slow down search response time significantly','','YesNo')");
+    print "Upgrade to $DBversion done ( Make COinS optional in OPAC search results )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.037';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACDisplay856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding OPACXSLT option must be on','OFF|Details|Results|Both','Choice')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('Display856uAsImage','OFF','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','OFF|Details|Results|Both','Choice')");
+    print "Upgrade to $DBversion done (Add 'Display856uAsImage' and 'OPACDisplay856uAsImage' syspref)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.03.00.038';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SelfCheckTimeout',120,'Define the number of seconds before the Web-based Self Checkout times out a patron','','Integer')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowSelfCheckReturns',0,'If enabled, patrons may return items through the Web-based Self Checkout','','YesNo')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SelfCheckHelpMessage','','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','70|10','Textarea')");
+    print "Upgrade to $DBversion done ( Add Self-checkout by Login system preferences )\n";
+    SetVersion ($DBversion);
+}
 
 =head1 FUNCTIONS