SetVersion($DBversion);
}
-$DBversion = "3.15.00.XXX";
+$DBversion = "3.15.00.004";
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);
+ if ( C4::Context->preference("marcflavour") eq 'MARC21' ) {
+ $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);
+}
+
+$DBversion = "3.15.00.005";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo');");
+ print "Upgrade to $DBversion done (Bug 8230: Add AcquisitionDetails system preference)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.006";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ ALTER TABLE `borrowers`
+ ADD KEY `surname_idx` (`surname`(255)),
+ ADD KEY `firstname_idx` (`firstname`(255)),
+ ADD KEY `othernames_idx` (`othernames`(255))
});
- $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 11249 - Add DB indexes on borrower names)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.007";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("ALTER TABLE items ADD itemlost_on DATETIME NULL AFTER itemlost");
+ $dbh->do("ALTER TABLE items ADD withdrawn_on DATETIME NULL AFTER withdrawn");
+ $dbh->do("ALTER TABLE deleteditems ADD itemlost_on DATETIME NULL AFTER itemlost");
+ $dbh->do("ALTER TABLE deleteditems ADD withdrawn_on DATETIME NULL AFTER withdrawn");
+ print "Upgrade to $DBversion done (Bug 9673 - Track when items are marked as lost or withdrawn)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.008";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ ALTER TABLE collections_tracking CHANGE ctId collections_tracking_id integer(11) NOT NULL auto_increment;
});
- print "Upgrade to $DBversion done (Bug 10970 - Update MARC21 frameworks to Update Nr. 17 - DB update)\n";
+ print "Upgrade to $DBversion done (Bug 11384) - change name of collections_tracker.ctId column)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.009";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ ALTER TABLE suggestions MODIFY suggesteddate DATE NOT NULL
+ });
+ print "Upgrade to $DBversion done (Bug 11391) - drop default value on suggestions.suggesteddate column)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.010";
+if(CheckVersion($DBversion)) {
+ $dbh->do("ALTER TABLE deleteditems DROP COLUMN marc");
+ print "Upgrade to $DBversion done (Bug 6331: remove obsolete column in deleteditems.marc)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.011";
+if(CheckVersion($DBversion)) {
+ $dbh->do("UPDATE marc_subfield_structure SET maxlength=9999 WHERE maxlength IS NULL OR maxlength=0;");
+ print "Upgrade to $DBversion done (Bug 8018: set 9999 as default max length for subfields)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.15.00.012";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'force_checkout', 'Force checkout if a limitation exists')
+ });
+ $dbh->do(q{
+ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'manage_restrictions', 'Manage restrictions for accounts')
+ });
+ $dbh->do(q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT user_permissions.borrowernumber, 1, 'force_checkout'
+ FROM user_permissions
+ LEFT JOIN borrowers USING(borrowernumber)
+ WHERE borrowers.flags & (1 << 1)
+ });
+ $dbh->do(q{
+ INSERT INTO user_permissions (borrowernumber, module_bit, code)
+ SELECT user_permissions.borrowernumber, 1, 'manage_restrictions'
+ FROM user_permissions
+ LEFT JOIN borrowers USING(borrowernumber)
+ WHERE borrowers.flags & (1 << 1)
+ });
+
+ print "Upgrade to $DBversion done (Bug 10863 - Add permissions force_checkout and manage_restrictions)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.013";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ UPDATE systempreferences
+ SET explanation = 'Upon receiving items, update their subfields if they were created when placing an order (e.g. o=5|a="foo bar")'
+ WHERE variable = "AcqItemSetSubfieldsWhenReceived"
+ });
+
+ $dbh->do(q{
+ UPDATE systempreferences
+ SET value = ''
+ WHERE variable = "AcqItemSetSubfieldsWhenReceived"
+ AND value = "0"
+ });
+ print "Upgrade to $DBversion done (Bug 11237: Update explanation and default value for AcqItemSetSubfieldsWhenReceived syspref)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.014";
+if (CheckVersion($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SelfCheckReceiptPrompt', '1', 'NULL', 'If ON, print receipt dialog pops up when self checkout is finished.', 'YesNo');");
+ print "Upgrade to $DBversion done (Bug 11415: add system preference for automatic self checkout receipt printing)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.015";
+if (CheckVersion($DBversion)) {
+ $dbh->do("INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES
+ ('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo');");
+ print "Upgrade to $DBversion done (Bug 10907: Add OpacSuggestionManagedBy system preference)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.016";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("ALTER TABLE biblioitems CHANGE url url TEXT NULL DEFAULT NULL");
+ $dbh->do("ALTER TABLE deletedbiblioitems CHANGE url url TEXT NULL DEFAULT NULL");
+ print "Upgrade to $DBversion done (Bug 11268 - Biblioitems URL field is too small for some URLs)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.017";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ UPDATE systempreferences
+ SET explanation = 'Define the contents of UNIMARC authority control field 100 position 08-35'
+ WHERE variable = "UNIMARCAuthorityField100"
+ });
+ $dbh->do(q{
+ UPDATE systempreferences
+ SET explanation = 'Define the contents of MARC21 authority control field 008 position 06-39'
+ WHERE variable = "MARCAuthorityControlField008"
+ });
+ $dbh->do(q{
+ UPDATE systempreferences
+ SET explanation = 'Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html'
+ WHERE variable = "MARCOrgCode"
+ });
+ print "Upgrade to $DBversion done (Bug 11611 - fix possible confusion between UNIMARC and MARC21 in some sysprefs)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.018";
+if ( CheckVersion($DBversion) ) {
+ $dbh->{AutoCommit} = 0;
+ $dbh->{RaiseError} = 1;
+
+ my $av_added = $dbh->do(q|
+ INSERT INTO authorised_values(category, authorised_value, lib, lib_opac)
+ SELECT 'ROADTYPE', roadtypeid, road_type, road_type
+ FROM roadtype;
+ |);
+
+ my $rt_deleted = $dbh->do(q|
+ DELETE FROM roadtype
+ |);
+
+ if ( $av_added == $rt_deleted or $rt_deleted eq "0E0" ) {
+ $dbh->do(q|
+ DROP TABLE roadtype;
+ |);
+ $dbh->commit;
+ print "Upgrade to $DBversion done (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values)\n";
+ SetVersion($DBversion);
+ } else {
+ print "Upgrade to $DBversion failed (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values.\nTransaction aborted because $@\n)";
+ $dbh->rollback;
+ }
+
+ $dbh->{AutoCommit} = 1;
+ $dbh->{RaiseError} = 0;
+}
+
+$DBversion = "3.15.00.019";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer')");
+ print "Upgrade to $DBversion done (Bug 11256: Add system preference OpacMaxItemsToDisplay)\n";
SetVersion($DBversion);
}
+$DBversion = "3.15.00.020";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+ $dbh->do(q|
+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer')
+ |);
+ print "Upgrade to $DBversion done (Bug 11343: Add system preference MaxItemsForBatch )\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.15.00.021";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ ALTER TABLE `action_logs`
+ DROP KEY timestamp,
+ ADD KEY `timestamp_idx` (`timestamp`),
+ ADD KEY `user_idx` (`user`),
+ ADD KEY `module_idx` (`module`(255)),
+ ADD KEY `action_idx` (`action`(255)),
+ ADD KEY `object_idx` (`object`),
+ ADD KEY `info_idx` (`info`(255))
+ });
+ print "Upgrade to $DBversion done (Bug 3445: Add indexes to action_logs table)\n";
+ SetVersion($DBversion);
+}
=head1 FUNCTIONS