From 75cdd63608596b02729d83f369eee8699eacb524 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 17 Apr 2019 17:01:10 +0000 Subject: [PATCH] Bug 22521: DBRev 18.12.00.055 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- Koha/Schema/Result/Accountline.pm | 8 +- .../data/mysql/atomicupdate/bug_22521.perl | 72 ------------------ installer/data/mysql/updatedatabase.pl | 73 +++++++++++++++++++ 4 files changed, 78 insertions(+), 77 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_22521.perl diff --git a/Koha.pm b/Koha.pm index 0523841385..320625972c 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.054"; +$VERSION = "18.12.00.055"; sub version { return $VERSION; diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index 3775f70b8b..6864e00bb0 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -67,7 +67,7 @@ __PACKAGE__->table("accountlines"); data_type: 'varchar' is_nullable: 1 - size: 5 + size: 16 =head2 status @@ -136,7 +136,7 @@ __PACKAGE__->add_columns( "description", { data_type => "longtext", is_nullable => 1 }, "accounttype", - { data_type => "varchar", is_nullable => 1, size => 5 }, + { data_type => "varchar", is_nullable => 1, size => 16 }, "status", { data_type => "varchar", is_nullable => 1, size => 16 }, "payment_type", @@ -285,8 +285,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OaHSR4SeurCr7h6nizbtBg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-17 17:00:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2NOxgVuaRQ+6oTqgYDqzBg sub koha_objects_class { 'Koha::Account::Lines'; diff --git a/installer/data/mysql/atomicupdate/bug_22521.perl b/installer/data/mysql/atomicupdate/bug_22521.perl deleted file mode 100644 index d437db3137..0000000000 --- a/installer/data/mysql/atomicupdate/bug_22521.perl +++ /dev/null @@ -1,72 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - $dbh->do(qq{ - UPDATE - `account_offset_types` - SET - type = 'OVERDUE' - WHERE - type = 'Fine'; - }); - - $dbh->do(qq{ - UPDATE - `account_offset_types` - SET - type = 'OVERDUE_INCREASE' - WHERE - type = 'fine_increase'; - }); - - $dbh->do(qq{ - UPDATE - `account_offset_types` - SET - type = 'OVERDUE_DECREASE' - WHERE - type = 'fine_decrease'; - }); - - if ( column_exists( 'accountlines', 'accounttype' ) ) { - $dbh->do( - qq{ - ALTER TABLE `accountlines` - CHANGE COLUMN `accounttype` - `accounttype` varchar(16) DEFAULT NULL; - } - ); - } - - $dbh->do(qq{ - UPDATE - accountlines - SET - accounttype = 'OVERDUE', - status = 'UNRETURNED' - WHERE - accounttype = 'FU'; - }); - - $dbh->do(qq{ - UPDATE - accountlines - SET - accounttype = 'OVERDUE', - status = 'FORGIVEN' - WHERE - accounttype = 'FFOR'; - }); - - $dbh->do(qq{ - UPDATE - accountlines - SET - accounttype = 'OVERDUE', - status = 'RETURNED' - WHERE - accounttype = 'F'; - }); - SetVersion($DBversion); - print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 1d2feb4baf..e4d36516f0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -18102,6 +18102,79 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 20128: Add permission for Advanced Cataloging Editor)\n"; } +$DBversion = '18.12.00.055'; +if ( CheckVersion($DBversion) ) { + + $dbh->do(qq{ + UPDATE + `account_offset_types` + SET + type = 'OVERDUE' + WHERE + type = 'Fine'; + }); + + $dbh->do(qq{ + UPDATE + `account_offset_types` + SET + type = 'OVERDUE_INCREASE' + WHERE + type = 'fine_increase'; + }); + + $dbh->do(qq{ + UPDATE + `account_offset_types` + SET + type = 'OVERDUE_DECREASE' + WHERE + type = 'fine_decrease'; + }); + + if ( column_exists( 'accountlines', 'accounttype' ) ) { + $dbh->do( + qq{ + ALTER TABLE `accountlines` + CHANGE COLUMN `accounttype` + `accounttype` varchar(16) DEFAULT NULL; + } + ); + } + + $dbh->do(qq{ + UPDATE + accountlines + SET + accounttype = 'OVERDUE', + status = 'UNRETURNED' + WHERE + accounttype = 'FU'; + }); + + $dbh->do(qq{ + UPDATE + accountlines + SET + accounttype = 'OVERDUE', + status = 'FORGIVEN' + WHERE + accounttype = 'FFOR'; + }); + + $dbh->do(qq{ + UPDATE + accountlines + SET + accounttype = 'OVERDUE', + status = 'RETURNED' + WHERE + accounttype = 'F'; + }); + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.20.1