SetVersion($DBversion);
}
+$DBversion = "3.13.00.037";
+if ( CheckVersion($DBversion) ) {
+ #add phone if it is not there already (explains the ignore option)
+ $dbh->do("
+INSERT IGNORE INTO message_transport_types (message_transport_type) values ('phone');
+ ");
+ print "Upgrade to $DBversion done (Bug 10572: Add phone to message_transport_types table for new installs)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.038";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES(15, 'superserials', 'Manage subscriptions from any branch (only applies when IndependentBranches is used)')");
+ print "Upgrade to $DBversion done (Bug 8435: Add superserials permission)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.039";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("
+ ALTER TABLE aqbasket ADD branch varchar(10) default NULL
+ ");
+ $dbh->do("
+ ALTER TABLE aqbasket
+ ADD CONSTRAINT aqbasket_ibfk_4 FOREIGN KEY (branch)
+ REFERENCES branches (branchcode)
+ ON UPDATE CASCADE ON DELETE SET NULL
+ ");
+ $dbh->do("
+ DROP TABLE IF EXISTS aqbasketusers
+ ");
+ $dbh->do("
+ CREATE TABLE aqbasketusers (
+ basketno int(11) NOT NULL,
+ borrowernumber int(11) NOT NULL,
+ PRIMARY KEY (basketno,borrowernumber),
+ CONSTRAINT aqbasketusers_ibfk_1 FOREIGN KEY (basketno) REFERENCES aqbasket (basketno) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT aqbasketusers_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+ $dbh->do("
+ INSERT INTO permissions (module_bit, code, description)
+ VALUES (11, 'order_manage_all', 'Manage all orders and baskets, regardless of restrictions on them')
+ ");
+
+ print "Upgrade to $DBversion done (Add branch and users list to baskets. "
+ . "New permission order_manage_all)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.040";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("CREATE TABLE IF NOT EXISTS marc_modification_templates (
+ template_id int(11) NOT NULL auto_increment,
+ name text NOT NULL,
+ PRIMARY KEY (template_id)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
+ );
+
+ $dbh->do("
+ CREATE TABLE IF NOT EXISTS marc_modification_template_actions (
+ mmta_id int(11) NOT NULL auto_increment,
+ template_id int(11) NOT NULL,
+ ordering int(3) NOT NULL,
+ action enum('delete_field','update_field','move_field','copy_field') NOT NULL,
+ field_number smallint(6) NOT NULL default '0',
+ from_field varchar(3) NOT NULL,
+ from_subfield varchar(1) NULL,
+ field_value varchar(100) default NULL,
+ to_field varchar(3) default NULL,
+ to_subfield varchar(1) default NULL,
+ to_regex_search text,
+ to_regex_replace text,
+ to_regex_modifiers varchar(8) default '',
+ conditional enum('if','unless') default NULL,
+ conditional_field varchar(3) default NULL,
+ conditional_subfield varchar(1) default NULL,
+ conditional_comparison enum('exists','not_exists','equals','not_equals') default NULL,
+ conditional_value text,
+ conditional_regex tinyint(1) NOT NULL default '0',
+ description text,
+ PRIMARY KEY (mmta_id),
+ CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ ");
+
+ $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ('13', 'marc_modification_templates', 'Manage marc modification templates')");
+
+ print "Upgrade to $DBversion done ( Bug 8015: Added tables for MARC Modification Framework )\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.041";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AcqItemSetSubfieldsWhenReceived','','Set subfields for item when items are created when receiving (e.g. o=5|a="foo bar")','','Free');
+ });
+ print "Upgrade to $DBversion done (Added AcqItemSetSubfieldsWhenReceived syspref)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.042";
+if(CheckVersion($DBversion)) {
+ print "Upgrade to $DBversion done (Koha 3.14 beta)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.13.00.043";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('SearchEngine','Zebra','Solr|Zebra','Search Engine','Choice')");
+ print "Upgrade to $DBversion done (Bug 11196: Add system preference SearchEngine if missing )\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.14.00.000";
+if ( CheckVersion($DBversion) ) {
+ print "Upgrade to $DBversion done (3.14.0 release)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = '3.15.00.000';
+if ( CheckVersion($DBversion) ) {
+ print "Upgrade to $DBversion done (the road goes ever on)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.001";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("UPDATE systempreferences SET value='clear' where variable = 'CircAutoPrintQuickSlip' and value = '0'");
+ $dbh->do("UPDATE systempreferences SET value='qslip' where variable = 'CircAutoPrintQuickSlip' and value = '1'");
+ $dbh->do("UPDATE systempreferences SET explanation = 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.', type = 'Choice' where variable = 'CircAutoPrintQuickSlip'");
+ print "Upgrade to $DBversion done (Bug 11040: Add option to print full slip when checking out a null barcode)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.002";
+if(CheckVersion($DBversion)) {
+ $dbh->do("ALTER TABLE deleteditems MODIFY materials text;");
+ print "Upgrade to $DBversion done (Bug 11275: alter deleteditems.materials from varchar(10) to text)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.003";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ UPDATE accountlines
+ SET description = ''
+ WHERE description IN (
+ ' New Card',
+ ' Fine',
+ ' Sundry',
+ 'Writeoff',
+ ' Account Management fee',
+ 'Payment,thanks', 'Payment,thanks - ',
+ ' Lost Item'
+ )
+ });
+ print "Upgrade to $DBversion done (Bug 2546: Update fine descriptions)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(qq{
+ INSERT IGNORE INTO marc_subfield_structure (tagfield, tagsubfield, liblibrarian, libopac, repeatable, mandatory,
+ kohafield, tab, authorised_value, authtypecode, value_builder, isurl, hidden, frameworkcode, seealso, link,
+ defaultvalue) VALUES
+ ('015', 'q', 'Qualifying information', 'Qualifying information', 1, 0, '', 0, '', '', '', 0, 0, '', '', '', NULL),
+ ('020', 'q', 'Qualifying information', 'Qualifying information', 1, 0, '', 0, '', '', '', 0, 0, '', '', '', NULL),
+ ('024', 'q', 'Qualifying information', 'Qualifying information', 1, 0, '', 0, '', '', '', 0, 0, '', '', '', NULL),
+ ('027', 'q', 'Qualifying information', 'Qualifying information', 1, 0, '', 0, '', '', '', 0, 0, '', '', '', NULL),
+ ('800', '7', 'Control subfield', 'Control subfield', 0, 0, '', 8, '', '', '', NULL, -6, '', '', '', NULL),
+ ('810', '7', 'Control subfield', 'Control subfield', 0, 0, '', 8, '', '', '', NULL, -6, '', '', '', NULL),
+ ('811', '7', 'Control subfield', 'Control subfield', 0, 0, '', 8, '', '', '', NULL, -6, '', '', '', NULL),
+ ('830', '7', 'Control subfield', 'Control subfield', 0, 0, '', 8, '', '', '', NULL, -6, '', '', '', NULL);
+ });
+ $dbh->do(qq{
+ INSERT IGNORE INTO auth_subfield_structure (authtypecode, tagfield, tagsubfield, liblibrarian, libopac, repeatable,
+ mandatory, tab, authorised_value, value_builder, seealso, isurl, hidden, linkid, kohafield, frameworkcode) VALUES
+ ('', '020', 'q', 'Qualifying information', 'Qualifying information', 1, 0, 0, NULL, NULL, NULL, 0, 0, '', '', ''),
+ ('', '024', 'q', 'Qualifying information', 'Qualifying information', 1, 0, 0, NULL, NULL, NULL, 0, 0, '', '', '');
+ });
+ print "Upgrade to $DBversion done (Bug 10970 - Update MARC21 frameworks to Update Nr. 17 - DB update)\n";
+ SetVersion($DBversion);
+}
+
+
=head1 FUNCTIONS
=head2 TableExists($table)