$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
- |);
+ eval {
+ $dbh->selectcol_arrayref(q|SELECT COUNT(*) FROM roadtype|);
+ };
+ unless ( $@ ) {
+ 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;
+ |);
- if ( $av_added == $rt_deleted or $rt_deleted eq "0E0" ) {
- $dbh->do(q|
- DROP TABLE roadtype;
+ my $rt_deleted = $dbh->do(q|
+ DELETE FROM 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;
- }
+ 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;
}
SetVersion($DBversion);
}
-$DBversion = "3.17.00.XXX";
+$DBversion = "3.17.00.023";
if ( CheckVersion($DBversion) ) {
$dbh->do(q{
INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('AcqItemSetSubfieldsWhenReceiptIsCancelled','', '','Upon cancelling a receipt, update the items subfields if they were created when placing an order (e.g. o=5|a="bar foo")', 'Free')
SetVersion($DBversion);
}
+$DBversion = "3.17.00.024";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ ALTER TABLE issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
+ });
+ $dbh->do(q{
+ ALTER TABLE old_issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
+ });
+ $dbh->do(q{
+ ALTER TABLE issuingrules ADD auto_renew BOOLEAN default FALSE AFTER norenewalbefore
+ });
+ print "Upgrade to $DBversion done (Bug 11577: [ENH] Automatic renewal feature)\n";
+ SetVersion($DBversion);
+}
+
+
+$DBversion = '3.17.00.025';
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(qq{
+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('StatisticsFields','location|itype|ccode','Define fields (from the items table) used for statistics members',NULL,'Free')
+ });
+ print "Upgrade to $DBversion done (Bug 12728: Checked syspref StatisticsFields)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.026";
+if ( CheckVersion($DBversion) ) {
+ if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
+ $dbh->do("UPDATE marc_subfield_structure SET liblibrarian = 'Encoded bitrate', libopac = 'Encoded bitrate' WHERE tagfield = '347' AND tagsubfield = 'f'");
+ $dbh->do("UPDATE marc_subfield_structure SET repeatable = 1 WHERE tagfield IN ('110','111','610','611','710','711','810','811') AND tagsubfield = 'c'");
+ $dbh->do("UPDATE auth_subfield_structure SET repeatable = 1 WHERE tagfield IN ('110','111','410','411','510','511','710','711') AND tagsubfield = 'c'");
+ print "Upgrade to $DBversion done (Bug 12435 - Update MARC21 frameworks to Update No. 18 (April 2014))\n";
+ }
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.027";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ DELETE FROM systempreferences WHERE variable = 'SearchEngine'
+ });
+ print "Upgrade to $DBversion done (Bug 12538 - Remove SearchEngine syspref)\n";
+ SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.028";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q{
+ INSERT INTO systempreferences (variable,value) VALUES('OpacCustomSearch','');
+ });
+ print "Upgrade to $DBversion done (Bug 12296 - search box replaceable with a system preference)\n";
+ SetVersion($DBversion);
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.029";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do("ALTER TABLE `items` CHANGE `cn_sort` `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+ $dbh->do("ALTER TABLE `deleteditems` CHANGE `cn_sort` `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+ $dbh->do("ALTER TABLE `biblioitems` CHANGE `cn_sort` `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+ $dbh->do("ALTER TABLE `deletedbiblioitems` CHANGE `cn_sort` `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+ print "Upgrade to $DBversion done (Bug 12424 - ddc sorting of call numbers truncates long Cutter parts)\n";
+ SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.030";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(
+ q{
+ INSERT INTO systempreferences (variable, value, options, explanation, type )
+ VALUES
+ ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'YesNo'),
+ ('UsageStatsID', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.', 'Free'),
+ ('UsageStatsLastUpdateTime', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.', 'Free'),
+ ('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
+ ('UsageStatsLibraryType', 'public', 'public|university', 'The library type to be shown on the Hea Koha community website', 'Choice'),
+ ('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
+ ('UsageStats', 0, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo')
+ });
+ print "Upgrade to $DBversion done (Bug 11926: Add UsageStats systempreferences (HEA))\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)