From cfe4d0e29546ccf7566ad326be7db76f0e0b4171 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 7 Mar 2019 17:27:05 +0000 Subject: [PATCH] Bug 20912: DBRev 18.12.00.021 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/Itemtype.pm | 20 +++++++++++++++++-- .../data/mysql/atomicupdate/bug_20912.perl | 19 ------------------ installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ 4 files changed, 39 insertions(+), 22 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_20912.perl diff --git a/Koha.pm b/Koha.pm index a30cf37baf..b9bd67ed72 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 = "18.12.00.020"; +$VERSION = "18.12.00.021"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index fdd507da6c..55331fe32a 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -41,6 +41,18 @@ __PACKAGE__->table("itemtypes"); is_nullable: 1 size: [28,6] +=head2 rentalcharge_daily + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + +=head2 rentalcharge_hourly + + data_type: 'decimal' + is_nullable: 1 + size: [28,6] + =head2 defaultreplacecost data_type: 'decimal' @@ -109,6 +121,10 @@ __PACKAGE__->add_columns( { data_type => "longtext", is_nullable => 1 }, "rentalcharge", { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "rentalcharge_daily", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, + "rentalcharge_hourly", + { data_type => "decimal", is_nullable => 1, size => [28, 6] }, "defaultreplacecost", { data_type => "decimal", is_nullable => 1, size => [28, 6] }, "processfee", @@ -226,8 +242,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GthTVMBLO5Zi6NU3up3m+A +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-03-07 17:30:46 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CDIOU6LmF7suaujk1NQOeg # Use the ItemtypeLocalization view to create the join on localization our $LANGUAGE; diff --git a/installer/data/mysql/atomicupdate/bug_20912.perl b/installer/data/mysql/atomicupdate/bug_20912.perl deleted file mode 100644 index c75eed9eb0..0000000000 --- a/installer/data/mysql/atomicupdate/bug_20912.perl +++ /dev/null @@ -1,19 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - if ( !column_exists( 'itemtypes', 'rentalcharge_daily' ) ) { - $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_daily` decimal(28,6) default NULL AFTER `rentalcharge`"); - } - - if ( !column_exists( 'itemtypes', 'rentalcharge_hourly' ) ) { - $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`"); - } - - if ( column_exists( 'itemtypes', 'rental_charge_daily' ) ) { - $dbh->do("UPDATE `itemtypes` SET `rentalcharge_daily` = `rental_charge_daily`"); - $dbh->do("ALTER TABLE `itemtypes` DROP COLUMN `rental_charge_daily`"); - } - - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 20912 - Support granular rental charges)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 07f16faaa9..87db4ade79 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -17551,6 +17551,26 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 18925 - Move maxissueqty and maxonsiteissueqty to circulation_rules)\n"; } +$DBversion = '18.12.00.021'; +if ( CheckVersion($DBversion) ) { + + if ( !column_exists( 'itemtypes', 'rentalcharge_daily' ) ) { + $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_daily` decimal(28,6) default NULL AFTER `rentalcharge`"); + } + + if ( !column_exists( 'itemtypes', 'rentalcharge_hourly' ) ) { + $dbh->do("ALTER TABLE `itemtypes` ADD COLUMN `rentalcharge_hourly` decimal(28,6) default NULL AFTER `rentalcharge_daily`"); + } + + if ( column_exists( 'itemtypes', 'rental_charge_daily' ) ) { + $dbh->do("UPDATE `itemtypes` SET `rentalcharge_daily` = `rental_charge_daily`"); + $dbh->do("ALTER TABLE `itemtypes` DROP COLUMN `rental_charge_daily`"); + } + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 20912 - Support granular rental charges)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5