X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=installer%2Fdata%2Fmysql%2Fupdatedatabase.pl;h=63a54c2114103a1b1ad142a1628f94696861ffd1;hb=e4fa2eafda0575c39ca6deb7e00dc887921f77b3;hp=d01f2bab914c58619732167823e74abd63046cc1;hpb=0d64db87d7764855dcb1227eeed46002a02220fc;p=srvgit diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d01f2bab91..63a54c2114 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -21260,12 +21260,17 @@ if( CheckVersion( $DBversion ) ) { $DBversion = '19.12.00.052'; if( CheckVersion( $DBversion ) ) { + my $finesCalendar = C4::Context->preference('finesCalendar'); + my $value = $finesCalendar eq 'noFinesWhenClosed' ? 1 : 0; + if( !column_exists( 'itemtypes', 'rentalcharge_daily_calendar' ) ) { $dbh->do(q{ ALTER TABLE itemtypes ADD COLUMN rentalcharge_daily_calendar tinyint(1) NOT NULL DEFAULT 1 AFTER rentalcharge_daily; }); + + $dbh->do("UPDATE itemtypes SET rentalcharge_daily_calendar = $value"); } if( !column_exists( 'itemtypes', 'rentalcharge_hourly_calendar' ) ) { @@ -21274,11 +21279,9 @@ if( CheckVersion( $DBversion ) ) { rentalcharge_hourly_calendar tinyint(1) NOT NULL DEFAULT 1 AFTER rentalcharge_hourly; }); - } - my $finesCalendar = C4::Context->preference('finesCalendar'); - my $value = $finesCalendar eq 'noFinesWhenClosed' ? 1 : 0; - $dbh->do("UPDATE itemtypes SET rentalcharge_hourly_calendar = $value, rentalcharge_daily_calendar = $value"); + $dbh->do("UPDATE itemtypes SET rentalcharge_hourly_calendar = $value"); + } NewVersion( $DBversion, 21443, "Add ability to exclude holidays when calculating rentals fees by time period"); } @@ -22678,6 +22681,201 @@ INSERT IGNORE INTO `letter` VALUES ('reserves','HOLD_CANCELLATION','','Hold Canc NewVersion( $DBversion, 25534, "Add ability to send an email specifying a reason when canceling a hold"); } +$DBversion = '20.06.00.030'; +if ( CheckVersion( $DBversion ) ) { + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES + ('AutoApprovePatronProfileSettings', '0', '', 'Automatically approve patron profile changes from the OPAC.', 'YesNo'); + }); + + NewVersion( $DBversion, 20057, "Add new system preference 'AutoApprovePatronProfileSettings'"); +} + +$DBversion = '20.06.00.031'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'reserves', 'non_priority' ) ) { + $dbh->do("ALTER TABLE reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold`"); + } + + if( !column_exists( 'old_reserves', 'non_priority' ) ) { + $dbh->do("ALTER TABLE old_reserves ADD COLUMN `non_priority` tinyint(1) NOT NULL DEFAULT 0 AFTER `item_level_hold`"); + } + + NewVersion( $DBversion, 22789, "Add non_priority column on reserves and old_reserves tables"); +} + +$DBversion = '20.06.00.032'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'items', 'exclude_from_local_holds_priority' ) ) { + $dbh->do(q{ + ALTER TABLE `items` ADD COLUMN `exclude_from_local_holds_priority` tinyint(1) default NULL AFTER `new_status` + }); + } + + if( !column_exists( 'deleteditems', 'exclude_from_local_holds_priority' ) ) { + $dbh->do(q{ + ALTER TABLE `deleteditems` ADD COLUMN `exclude_from_local_holds_priority` tinyint(1) default NULL AFTER `new_status` + }); + } + + if( !column_exists( 'categories', 'exclude_from_local_holds_priority' ) ) { + $dbh->do(q{ + ALTER TABLE `categories` ADD COLUMN `exclude_from_local_holds_priority` tinyint(1) default NULL AFTER `change_password` + }); + } + NewVersion( $DBversion, 19889, "Add exclude_from_local_holds_priority column to items, deleteditems and categories tables"); +} + +$DBversion = '20.06.00.033'; +if( CheckVersion( $DBversion ) ) { + if( column_exists( 'opac_news', 'timestamp' ) ) { + $dbh->do(q| + ALTER TABLE opac_news + CHANGE COLUMN timestamp published_on date DEFAULT NULL + |); + } + if( !column_exists( 'opac_news', 'updated_on' ) ) { + $dbh->do(q| + ALTER TABLE opac_news + ADD COLUMN updated_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER published_on + |); + } + + $dbh->do(q| + UPDATE letter + SET content = REPLACE(content,?,?) + WHERE content LIKE ? + |, undef, 'opac_news.timestamp', 'opac_news.published_on', '%opac_news.timestamp%' ); + + NewVersion( $DBversion, 21066, ["Rename column opac_news.timestamp with published_on", "Add new column opac_news.updated_on", "Replace timestamp references in letters table"] ); +} + +$DBversion = '20.06.00.034'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q| + INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) + VALUES ('AddressForFailedOverdueNotices', '', NULL, 'Destination email for failed overdue notices. If left empty then it will fallback to the first defined address in the following list: Library ReplyTo, Library Email, ReplytoDefault and KohaAdminEmailAddress', 'free') + |); + + NewVersion( $DBversion, 24197, "Add new system preference 'AddressForFailedOverdueNotices'" ); +} + +$DBversion = '20.06.00.035'; +if ( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice') + }); + + NewVersion( $DBversion, 23682, "Add new system preference 'EdifactInvoiceImport'" ); +} + +$DBversion = '20.06.00.036'; +if( CheckVersion( $DBversion ) ) { + # Fix the markup in the OPACSearchForTitleIn system preference + $dbh->do("UPDATE systempreferences SET VALUE = replace( value, '', ''), value = REPLACE( value, '
  • ', '') WHERE VARIABLE = 'OPACSearchForTitleIn';"); + + NewVersion( $DBversion, 20168, "Update OPACSearchForTitleIn to work with Bootstrap 4"); +} + +$DBversion = '20.06.00.037'; +if( CheckVersion( $DBversion ) ) { + if( !column_exists( 'categories', 'min_password_length' ) ) { + $dbh->do("ALTER TABLE categories ADD COLUMN `min_password_length` smallint(6) NULL DEFAULT NULL AFTER `change_password` -- set minimum password length for patrons in this category"); + } + if( !column_exists( 'categories', 'require_strong_password' ) ) { + $dbh->do("ALTER TABLE categories ADD COLUMN `require_strong_password` TINYINT(1) NULL DEFAULT NULL AFTER `min_password_length` -- set required password strength for patrons in this category"); + } + + NewVersion( $DBversion, 23816, "Add min_password_length and require_strong_password columns in categories table"); +} + +$DBversion = '20.06.00.038'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( "ALTER TABLE `search_field` MODIFY COLUMN `type` enum('','string','date','number','boolean','sum','isbn','stdno','year') NOT NULL" ); + $dbh->do( "UPDATE `search_field` SET type = 'year' WHERE name = 'date-of-publication'" ); + + NewVersion( $DBversion, 24807, "Add 'year' type to improve sorting behaviour" ); +} + +$DBversion = '20.06.00.039'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'hold_fill_targets', 'reserve_id' ) ) { + $dbh->do( "ALTER TABLE hold_fill_targets ADD COLUMN reserve_id int(11) DEFAULT NULL AFTER item_level_request" ); + } + + NewVersion( $DBversion, 18958, "Add reserve_id to hold_fill_targets"); +} + +$DBversion = '20.06.00.040'; +if( CheckVersion( $DBversion ) ) { + $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea');" ); + + NewVersion( $DBversion, 26454, "Add system preference to set meta description for the OPAC"); +} + +$DBversion = '20.06.00.041'; +if ( CheckVersion($DBversion) ) { + + if ( column_exists( 'items', 'paidfor' ) ) { + my ($count) = $dbh->selectrow_array( + q| + SELECT COUNT(*) + FROM items + WHERE paidfor IS NOT NULL AND paidfor <> "" + | + ); + if ($count) { + warn "Warning - Cannot remove column items.paidfor. At least one value exists"; + } + else { + $dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|); + $dbh->do(q|UPDATE marc_subfield_structure SET kohafield = '' WHERE kohafield = 'items.paidfor'|); + } + } + + if ( column_exists( 'deleteditems', 'paidfor' ) ) { + my ($count) = $dbh->selectrow_array( + q| + SELECT COUNT(*) + FROM deleteditems + WHERE paidfor IS NOT NULL AND paidfor <> "" + | + ); + if ($count) { + warn "Warning - Cannot remove column deleteditems.paidfor. At least one value exists"; + } + else { + $dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|); + } + } + + NewVersion( $DBversion, 26268, "Remove items.paidfor field" ); +} + +$DBversion = '20.06.00.042'; +if( CheckVersion( $DBversion ) ) { + unless ( column_exists('letter', 'updated_on') ) { + $dbh->do(q| + ALTER TABLE letter ADD COLUMN updated_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER lang + |); + } + + NewVersion( $DBversion, 25776, "Add letter.updated_on"); +} + +$DBversion = '20.06.00.043'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('CircConfirmItemParts', '0', NULL, 'Require staff to confirm that all parts of an item are present at checkin/checkout.', 'YesNo') + }); + + NewVersion( $DBversion, 25261, "Add CircConfirmItemParts syspref"); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';