#!/usr/bin/perl
-
# Database Updater
# This script checks for required updates to the database.
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo')");
SetVersion ($DBversion);
- print "Upgrade to $DBversion done (added a preference to hide the patrons name in the staff catalog)";
+ print "Upgrade to $DBversion done (added a preference to hide the patrons name in the staff catalog)\n";
}
$DBversion = "3.01.00.046";
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
- SetVersion ($DBversion);
+ SetVersion ($DBversion);print "Upgrade to $DBversion done (Created table fieldmapping)\n";print "Upgrade to 3.01.00.064 done (Version number skipped: nothing done)\n";
}
$DBversion = '3.01.00.065';
$DBversion = "3.01.00.068";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("ALTER TABLE issuingrules ADD COLUMN `finedays` int(11) default NULL AFTER `fine` ");
- print "Upgrade done (Adding finedays in issuingrules table)\n";
+ print "Upgrade to $DBversion done (Adding finedays in issuingrules table)\n";
SetVersion ($DBversion);
}
SEARCHHIST
$dbh->do($create);
- print "Upgrade done (added OPAC search history preference and table)\n";
+ print "Upgrade to $DBversion done (added OPAC search history preference and table)\n";
}
$DBversion = "3.01.00.070";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("ALTER TABLE authorised_values ADD COLUMN `lib_opac` VARCHAR(80) default NULL AFTER `lib`");
- print "Upgrade done (Added a lib_opac field in authorised_values table)\n";
+ print "Upgrade to $DBversion done (Added a lib_opac field in authorised_values table)\n";
}
$DBversion = "3.01.00.071";
ADD itemtype VARCHAR(30) default NULL
;
SUGGESTIONS
- print "Upgrade to $DBversion done Suggestions";
+ print "Upgrade to $DBversion done (Suggestions)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.087";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("ALTER table aqbudgets drop column budget_amount_sublevel;");
- print "Upgrade to $DBversion done drop column budget_amount_sublevel from aqbudgets\n";
+ print "Upgrade to $DBversion done (Drop column budget_amount_sublevel from aqbudgets)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.100";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('casAuthentication', '0', '', 'Enable or disable CAS authentication', 'YesNo'), ('casLogout', '1', '', 'Does a logout from Koha should also log out of CAS ?', 'YesNo'), ('casServerUrl', 'https://localhost:8443/cas', '', 'URL of the cas server', 'Free')");
- print "Upgrade done (added CAS authentication system preferences)\n";
+ print "Upgrade to $DBversion done (added CAS authentication system preferences)\n";
SetVersion ($DBversion);
}
$dbh->do(
"UPDATE permissions set description = 'Edit catalog (Modify bibliographic/holdings data)' where module_bit = 9 and code = 'edit_catalogue'"
);
- print "Upgrade done (fixed spelling error in edit_catalogue permission)\n";
+ print "Upgrade to $DBversion done (fixed spelling error in edit_catalogue permission)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.103";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES (13, 'moderate_tags', 'Moderate patron tags')");
- print "Upgrade done (adding patron permissions for tags tool)\n";
+ print "Upgrade to $DBversion done (adding patron permissions for tags tool)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.106";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' )");
- print "Upgrade done (added OpacAddMastheadLibraryPulldown system preferences)\n";
+ print "Upgrade to $DBversion done (added OpacAddMastheadLibraryPulldown system preferences)\n";
SetVersion ($DBversion);
}
ADD `field_separator` VARCHAR( 2 ) NOT NULL AFTER `csv_separator` ,
ADD `subfield_separator` VARCHAR( 2 ) NOT NULL AFTER `field_separator`
});
- print "Upgrade done (added separators for csv export)\n";
+ print "Upgrade to $DBversion done (added separators for csv export)\n";
SetVersion ($DBversion);
}
$dbh->do(qq{
ALTER TABLE `export_format` ADD `encoding` VARCHAR(255) NOT NULL AFTER `subfield_separator`
});
- print "Upgrade done (added encoding for csv export)\n";
+ print "Upgrade to $DBversion done (added encoding for csv export)\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.110';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do('ALTER TABLE `categories` ADD COLUMN `enrolmentperioddate` DATE NULL DEFAULT NULL AFTER `enrolmentperiod`');
- print "Upgrade done (Add enrolment period date support)\n";
+ print "Upgrade to $DBversion done (Add enrolment period date support)\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.111';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
- print "Upgrade done (mark DBrev for 3.2-alpha release)\n";
+ print "Upgrade to $DBversion done (mark DBrev for 3.2-alpha release)\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.112';
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SpineLabelShowPrintOnBibDetails', '0', '', 'If turned on, a \"Print Label\" link will appear for each item on the bib details page in the staff interface.', 'YesNo');");
- print "Upgrade done ( added Show Spine Label Printer on Bib Items Details preferences )\n";
+ print "Upgrade to $DBversion done ( added Show Spine Label Printer on Bib Items Details preferences )\n";
SetVersion ($DBversion);
}
$dbh->do(
"INSERT INTO systempreferences (variable,value,type)
VALUES('OPACXSLTDetailsDisplay',?,'YesNo')", {}, $value ? 1 : 0);
- print "Upgrade done (added two new syspref: OPACXSLTResultsDisplay and OPACXSLTDetailDisplay). You may have to go in Admin > System preference to tweak XSLT related syspref both in OPAC and Search tabs.\n ";
+ print "Upgrade to $DBversion done (added two new syspref: OPACXSLTResultsDisplay and OPACXSLTDetailDisplay). You may have to go in Admin > System preference to tweak XSLT related syspref both in OPAC and Search tabs.\n";
SetVersion ($DBversion);
}
if (C4::Context->preference('OrderPdfFormat') eq 'pdfformat::example'){
$dbh->do("UPDATE `systempreferences` set value='pdfformat::layout2pages' WHERE variable='OrderPdfFormat'");
}
- print "Upgrade done ( corrected default OrderPdfFormat value if still set wrong )\n";
+ print "Upgrade to $DBversion done (corrected default OrderPdfFormat value if still set wrong )\n";
SetVersion ($DBversion);
}
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("UPDATE `permissions` SET `code` = 'items_batchdel' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchdel' LIMIT 1 ;");
$dbh->do("UPDATE `permissions` SET `code` = 'items_batchmod' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchmod' LIMIT 1 ;");
- print "Upgrade done (Change permissions names for item batch modification / deletion)\n";
+ print "Upgrade to $DBversion done (Change permissions names for item batch modification / deletion)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.130";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("UPDATE reserves SET expirationdate = NULL WHERE expirationdate = '0000-00-00'");
- print "Upgrade done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)";
+ print "Upgrade to $DBversion done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.134';
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('DisplayMultiPlaceHold','1','Display the ability to place multiple holds or not','','YesNo')");
- print "Upgrade to $DBversion done adding syspref DisplayMultiPlaceHold to control whether multiple holds can be placed from the search results page";
+ print "Upgrade to $DBversion done (adding syspref DisplayMultiPlaceHold to control whether multiple holds can be placed from the search results page)\n";
SetVersion ($DBversion);
}
INSERT INTO `letter` (module, code, name, title, content) VALUES
('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n')
");
- print "Upgrade to $DBversion done (bug 4377: added HOLD_PRINT message template)";
+ print "Upgrade to $DBversion done (bug 4377: added HOLD_PRINT message template)\n";
SetVersion ($DBversion);
}
$dbh->do(qq{
INSERT INTO permissions (module_bit, code, description) VALUES
( 9, 'edit_items', 'Edit Items');});
- print "Upgrade to $DBversion done Adding a new permission to edit items";
+ print "Upgrade to $DBversion done (Adding a new permission to edit items)\n";
SetVersion ($DBversion);
}
(15, 'renew_subscription', 'Renew a subscription'),
(15, 'routing', 'Routing');
");
- print "Upgrade to $DBversion done (adding granular permissions for serials)";
+ print "Upgrade to $DBversion done (adding granular permissions for serials)\n";
SetVersion ($DBversion);
}
$DBversion = "3.01.00.138";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("DELETE FROM systempreferences WHERE variable = 'GranularPermissions'");
- print "Upgrade to $DBversion done (bug 4896: removing GranularPermissions syspref; use of granular permissions is now the default)";
+ print "Upgrade to $DBversion done (bug 4896: removing GranularPermissions syspref; use of granular permissions is now the default)\n";
SetVersion ($DBversion);
}
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do(qq{DELETE FROM message_attributes WHERE message_attribute_id=3;});
$dbh->do(qq{DELETE FROM letter WHERE code='EVENT' AND title='Upcoming Library Event';});
- print "Upgrade to $DBversion done Remove upcoming events messaging option (bug 2434)";
+ print "Upgrade to $DBversion done Remove upcoming events messaging option (bug 2434)\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.142';
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do(qq{DELETE FROM message_transports WHERE message_attribute_id=3;});
- print "Upgrade to $DBversion done Remove upcoming events messaging option part 2 (bug 2434)";
+ print "Upgrade to $DBversion done (Remove upcoming events messaging option part 2 (bug 2434))\n";
SetVersion ($DBversion);
}
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do(qq{CREATE INDEX auth_value_idx ON authorised_values (authorised_value)});
$dbh->do(qq{CREATE INDEX auth_val_cat_idx ON borrower_attribute_types (authorised_value_category)});
- print "Create index on authorised_values and borrower_attribute_types (bug 4139)";
+ print "Upgrade to $DBversion done (Create index on authorised_values and borrower_attribute_types (bug 4139))\n";
SetVersion ($DBversion);
}
$DBversion = '3.01.00.144';
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do(qq{UPDATE systempreferences SET value='normal' where value='default' and variable='IntranetBiblioDefaultView'});
- print "Update the 'default' to 'normal' for the IntranetBiblioDefaultView syspref (bug 5007)";
+ print "Upgrade to $DBversion done (Update the 'default' to 'normal' for the IntranetBiblioDefaultView syspref (bug 5007))\n";
SetVersion ($DBversion);
}
$DBversion = '3.03.00.008';
if (C4::Context->preference('Version') < TransformToNum($DBversion)){
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea')");
- print "Upgrade to $DBversion done adding syspref OPACNoResultsFound to control what displays when no results are found for a search in the OPAC.";
+ print "Upgrade to $DBversion done (adding syspref OPACNoResultsFound to control what displays when no results are found for a search in the OPAC.)\n";
SetVersion ($DBversion);
}
SetVersion ($DBversion);
}
-$DBversion = "3.05.00.XXX";
+$DBversion = "3.05.00.003";
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
$dbh->do(qq{
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
SetVersion($DBversion);
}
+$DBversion = "3.05.00.004";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo');");
+ print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.005";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');");
+ print "Upgrade to $DBversion done (Adds pref BasketConfirmations)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.006";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn | a|a d', NULL, NULL, 'Textarea')");
+ print "Upgrade to $DBversion done (Add syspref MARCAuthorityControlField008)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.05.00.007";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo');");
+ print "Upgrade to $DBversion done (Add syspref OpenLibraryCovers)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.008";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE `cities` ADD `city_state` VARCHAR( 100 ) NULL DEFAULT NULL AFTER `city_name`;");
+ $dbh->do("ALTER TABLE `cities` ADD `city_country` VARCHAR( 100 ) NULL DEFAULT NULL AFTER `city_zipcode`;");
+ print "Add state and country to cities table corresponding to new columns in borrowers\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.009";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO old_issues (borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate)
+ SELECT borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate FROM issues WHERE borrowernumber IS NULL");
+ $dbh->do("DELETE FROM issues WHERE borrowernumber IS NULL");
+
+ $dbh->do("INSERT INTO old_issues (borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate)
+ SELECT borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate FROM issues WHERE itemnumber IS NULL");
+ $dbh->do("DELETE FROM issues WHERE itemnumber IS NULL");
+
+ $dbh->do("INSERT INTO old_issues (borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate)
+ SELECT borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate FROM issues WHERE NOT EXISTS (SELECT * FROM borrowers WHERE borrowernumber = issues.borrowernumber)");
+ $dbh->do("DELETE FROM issues WHERE NOT EXISTS (SELECT * FROM borrowers WHERE borrowernumber = issues.borrowernumber)");
+
+ $dbh->do("INSERT INTO old_issues (borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate)
+ SELECT borrowernumber, itemnumber, date_due, branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp, issuedate FROM issues WHERE NOT EXISTS (SELECT * FROM items WHERE itemnumber = issues.itemnumber)");
+ $dbh->do("DELETE FROM issues WHERE NOT EXISTS (SELECT * FROM items WHERE itemnumber = issues.itemnumber)");
+
+ $dbh->do("ALTER TABLE issues DROP FOREIGN KEY `issues_ibfk_1`");
+ $dbh->do("ALTER TABLE issues DROP FOREIGN KEY `issues_ibfk_2`");
+ $dbh->do("ALTER TABLE issues ALTER COLUMN borrowernumber DROP DEFAULT");
+ $dbh->do("ALTER TABLE issues ALTER COLUMN itemnumber DROP DEFAULT");
+ $dbh->do("ALTER TABLE issues MODIFY COLUMN borrowernumber int(11) NOT NULL");
+ $dbh->do("ALTER TABLE issues MODIFY COLUMN itemnumber int(11) NOT NULL");
+ $dbh->do("ALTER TABLE issues DROP KEY `issuesitemidx`");
+ $dbh->do("ALTER TABLE issues ADD PRIMARY KEY (`itemnumber`)");
+ $dbh->do("ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE");
+ $dbh->do("ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE");
+
+ print "Upgrade to $DBversion done (issues referential integrity)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.05.00.010";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("CREATE INDEX priorityfoundidx ON reserves (priority,found)");
+ print "Create an index on reserves to speed up holds awaiting pickup report bug 5866\n";
+ SetVersion($DBversion);
+}
+
+
+$DBversion = "3.05.00.011";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea')");
+ print "Upgrade to $DBversion done (add OPACResultsSidebar syspref (enh 6165))\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.012";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RecordLocalUseOnReturn',0,'If ON, statistically record returns of unissued items as local use, instead of return',NULL,'YesNo')");
+ print "Upgrade to $DBversion done (add RecordLocalUseOnReturn syspref (enh 6403))\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.013";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do(qq|INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','0',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL)|);
+ print "Upgrade to $DBversion done (Add syspref 'OpacKohaUrl')\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.014";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE `borrowers` MODIFY `userid` VARCHAR(75)");
+ print "Modified userid column length into 75 in borrowers\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.015";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectEnabled',0,'Enable Novelist Select content. Requires Novelist Profile and Password',NULL,'YesNo')");
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectProfile',NULL,'Novelist Select user Password',NULL,'free')");
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectPassword',NULL,'Enable Novelist user Profile',NULL,'free')");
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('NovelistSelectView','tab','Where to display Novelist Select content','tab|above|below|right','Choice')");
+ print "Upgrade to $DBversion done (Add support for EBSCO's NoveList Select (enh 6902))\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = '3.05.00.016';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');");
+ print "Upgrade to $DBversion done (Add EasyAnalyticalRecords syspref)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = '3.05.00.017';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ if (C4::Context->preference("marcflavour") eq 'MARC21' ||
+ C4::Context->preference("marcflavour") eq 'NORMARC'){
+ $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
+ $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
+ print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n";
+ SetVersion ($DBversion);
+ } elsif (C4::Context->preference("marcflavour") eq 'UNIMARC'){
+ $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
+ print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
+ SetVersion ($DBversion);
+ }
+
+}
+
+$DBversion = "3.05.00.018";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNavBottom','','Links after OpacNav links','70|10','Textarea')");
+ print "Upgrade to $DBversion done (add OpacNavBottom syspref (enh 6825): if appropriate, you can split OpacNav into OpacNav and OpacNavBottom)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.019";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("UPDATE itemtypes SET imageurl = 'vokal/Book.png' WHERE imageurl = 'vokal/BOOK.png'");
+ $dbh->do("UPDATE itemtypes SET imageurl = 'vokal/Book-32px.png' WHERE imageurl = 'vokal/BOOK-32px.png'");
+ $dbh->do("UPDATE authorised_values SET imageurl = 'vokal/Book.png' WHERE imageurl = 'vokal/BOOK.png'");
+ $dbh->do("UPDATE authorised_values SET imageurl = 'vokal/Book-32px.png' WHERE imageurl = 'vokal/BOOK-32px.png'");
+ print "Upgrade to $DBversion done (remove duplicate VOKAL Book icons, bug 6862)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.020";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice')");
+ print "Upgrade to $DBversion done (Add syspref AcqViewBaskets)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.021";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE borrower_attribute_types ADD COLUMN display_checkout TINYINT(1) NOT NULL DEFAULT '0';");
+ print "Upgrade to $DBversion done (Added a display_checkout field in borrower_attribute_types table)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.022";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("CREATE TABLE need_merge_authorities (id int NOT NULL auto_increment PRIMARY KEY, authid bigint NOT NULL, done tinyint DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=utf8");
+ print "Upgrade to $DBversion done (6094: Fixing ModAuthority problems, add a need_merge_authorities table)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.05.00.023";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');");
+ print "Upgrade to $DBversion done (Add syspref OpacShowRecentComments. When the preference is turned on a link to recent comments will appear in the OPAC masthead. )\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.06.00.000";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ print "Upgrade to $DBversion done Koha 3.6.0 release \n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.06.00.001";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred <>0;", { Columns => [1] } );
+ $dbh->do("ALTER TABLE borrowers MODIFY debarred DATE DEFAULT NULL;");
+ $dbh->do( "UPDATE borrowers set debarred='9999-12-31' where borrowernumber IN (" . join( ",", @$borrowers ) . ");" ) if ($borrowers and scalar(@$borrowers)>0);
+ $dbh->do("ALTER TABLE borrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
+ $dbh->do("ALTER TABLE deletedborrowers MODIFY debarred DATE DEFAULT NULL;");
+ $dbh->do("ALTER TABLE deletedborrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
+ print "Upgrade done (Change borrowers.debarred into Date )\n";
+
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.06.00.002";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("UPDATE borrowers SET debarred=NULL WHERE debarred='0000-00-00';");
+ print "Setting NULL to debarred where 0000-00-00 is stored (bug 7272)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.06.02.001";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(" UPDATE `message_attributes` SET message_name='Item_Due' WHERE message_name='Item_DUE'");
+ print "Updating message_name in message_attributes\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)