From 14fa7c112c9bfd685de7f062c732f8069aebb0ff Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 4 Feb 2020 10:08:50 +0000 Subject: [PATCH] Bug 18936: DBRev 19.12.00.018 Signed-off-by: Martin Renvoize --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_18936.perl | 48 ------------------ installer/data/mysql/updatedatabase.pl | 49 +++++++++++++++++++ 3 files changed, 50 insertions(+), 49 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_18936.perl diff --git a/Koha.pm b/Koha.pm index 31613b5dd2..c27e9596e5 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "19.12.00.017"; +$VERSION = "19.12.00.018"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_18936.perl b/installer/data/mysql/atomicupdate/bug_18936.perl deleted file mode 100644 index 160c5b167f..0000000000 --- a/installer/data/mysql/atomicupdate/bug_18936.perl +++ /dev/null @@ -1,48 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - my @columns = qw( - restrictedtype - rentaldiscount - fine - finedays - maxsuspensiondays - suspension_chargeperiod - firstremind - chargeperiod - chargeperiod_charge_at - accountsent - issuelength - lengthunit - hardduedate - hardduedatecompare - renewalsallowed - renewalperiod - norenewalbefore - auto_renew - no_auto_renewal_after - no_auto_renewal_after_hard_limit - reservesallowed - holds_per_record - holds_per_day - onshelfholds - opacitemholds - overduefinescap - cap_fine_to_replacement_price - article_requests - note - ); - - if ( column_exists( 'issuingrules', 'categorycode' ) ) { - foreach my $column ( @columns ) { - $dbh->do(" - INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) - SELECT IF(categorycode='*', NULL, categorycode), IF(branchcode='*', NULL, branchcode), IF(itemtype='*', NULL, itemtype), \'$column\', COALESCE( $column, '' ) - FROM issuingrules - "); - } - $dbh->do("DROP TABLE issuingrules"); - } - - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 18936: Convert issuingrules fields to circulation_rules)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 65c9b18f6c..3f17b16baf 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20683,6 +20683,55 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 21674 - Add unique key (parent_id, branchcode) to library_group)\n"; } +$DBversion = '19.12.00.018'; +if( CheckVersion( $DBversion ) ) { + my @columns = qw( + restrictedtype + rentaldiscount + fine + finedays + maxsuspensiondays + suspension_chargeperiod + firstremind + chargeperiod + chargeperiod_charge_at + accountsent + issuelength + lengthunit + hardduedate + hardduedatecompare + renewalsallowed + renewalperiod + norenewalbefore + auto_renew + no_auto_renewal_after + no_auto_renewal_after_hard_limit + reservesallowed + holds_per_record + holds_per_day + onshelfholds + opacitemholds + overduefinescap + cap_fine_to_replacement_price + article_requests + note + ); + + if ( column_exists( 'issuingrules', 'categorycode' ) ) { + foreach my $column ( @columns ) { + $dbh->do(" + INSERT INTO circulation_rules ( categorycode, branchcode, itemtype, rule_name, rule_value ) + SELECT IF(categorycode='*', NULL, categorycode), IF(branchcode='*', NULL, branchcode), IF(itemtype='*', NULL, itemtype), \'$column\', COALESCE( $column, '' ) + FROM issuingrules + "); + } + $dbh->do("DROP TABLE issuingrules"); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 18936: Convert issuingrules fields to circulation_rules)\n"; +} + # 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/'; -- 2.39.5