SetVersion($DBversion);
}
+$DBversion = "3.09.00.037";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseTransportCostMatrix',0,'Use Transport Cost Matrix when filling holds','','YesNo')");
+
+ $dbh->do("CREATE TABLE `transport_cost` (
+ `frombranch` varchar(10) NOT NULL,
+ `tobranch` varchar(10) NOT NULL,
+ `cost` decimal(6,2) NOT NULL,
+ `disable_transfer` tinyint(1) NOT NULL DEFAULT 0,
+ CHECK ( `frombranch` <> `tobranch` ), -- a dud check, mysql does not support that
+ PRIMARY KEY (`frombranch`, `tobranch`),
+ CONSTRAINT `transport_cost_ibfk_1` FOREIGN KEY (`frombranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `transport_cost_ibfk_2` FOREIGN KEY (`tobranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8");
+
+ print "Upgrade to $DBversion done (creating `transport_cost` table; adding UseTransportCostMatrix systempref, in circulation)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion ="3.09.00.038";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE borrower_attributes CHANGE attribute attribute VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+ print "Upgrade to $DBversion done (Increase the maximum size of a borrower attribute value)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.039";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('DidYouMeanFromAuthorities','0','Suggest searches based on authority file.','YesNo');");
+ print "Upgrade to $DBversion done (Add system preference DidYouMeanFromAuthorities)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.040";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IncludeSeeFromInSearches','0','','Include see-from references in searches.','YesNo');");
+ print "Upgrade to $DBversion done (Add IncludeSeeFromInSearches system preference)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.041";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(qq{
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('ExportRemoveFields','','List of fields for non export in circulation.pl (separated by a space)','','');
+ });
+ print "Upgrade to $DBversion done (Add system preference ExportRemoveFields)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.042";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(qq{
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('ExportWithCsvProfile','','Set a profile name for CSV export','','');
+ });
+ print "Upgrade to $DBversion done (Adds New System preference ExportWithCsvProfile)\n";
+ SetVersion($DBversion)
+}
+
+$DBversion = "3.09.00.043";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("
+ ALTER TABLE aqorders
+ ADD parent_ordernumber int(11) DEFAULT NULL
+ ");
+ $dbh->do("
+ UPDATE aqorders
+ SET parent_ordernumber = ordernumber;
+ ");
+ print "Upgrade to $DBversion done (Adding parent_ordernumber in aqorders)\n";
+ 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");
+ $dbh->do("UPDATE statistics SET statistics.ccode = ( SELECT items.ccode FROM items WHERE statistics.itemnumber = items.itemnumber )");
+ $dbh->do("UPDATE statistics SET statistics.ccode = (
+ SELECT deleteditems.ccode FROM deleteditems
+ WHERE statistics.itemnumber = deleteditems.itemnumber
+ ) WHERE statistics.ccode IS NULL");
+ print "Upgrade done ( Added Collection Code to Statistics table. )\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.045";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE borrower_attribute_types MODIFY category_code VARCHAR( 10 ) NULL DEFAULT NULL");
+ print "Upgrade to $DBversion done. (Bug 8002: Update patron attribute types table from varchar(1) to varchar(10) category_code)\nWarning to Koha System Administrators: If you use borrower attributes defined by borrower categories, you have to check your configuration. A bug may have removed your attribute links to borrower categories.\nPlease check, and fix it if necessary.";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.046";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE `accountlines` ADD `accountlines_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;");
+ print "Upgrade to $DBversion done (adding accountlines_id field in accountlines table)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)