From cec049bf80c05e6c32d29d935f6cd1421247aaac Mon Sep 17 00:00:00 2001 From: Joy Nelson Date: Fri, 13 Mar 2020 01:10:09 +0000 Subject: [PATCH] Bug 24532: DBRev 19.11.03.004 Signed-off-by: Joy Nelson --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_24532.perl | 43 ------------------ installer/data/mysql/updatedatabase.pl | 44 +++++++++++++++++++ 3 files changed, 45 insertions(+), 44 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_24532.perl diff --git a/Koha.pm b/Koha.pm index c91f711e19..0532011d40 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.11.03.003"; +$VERSION = "19.11.03.004"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_24532.perl b/installer/data/mysql/atomicupdate/bug_24532.perl deleted file mode 100644 index f5347e8728..0000000000 --- a/installer/data/mysql/atomicupdate/bug_24532.perl +++ /dev/null @@ -1,43 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if( CheckVersion( $DBversion ) ) { - - # Add any pathalogical incorrect debit_types as credit_types as appropriate - $dbh->do( - qq{ - INSERT IGNORE INTO account_credit_types ( - code, - description, - can_be_added_manually, - is_system - ) - SELECT - DISTINCT(debit_type_code), - "Unexpected type found during upgrade", - 1, - 0 - FROM - accountlines - WHERE - amount < 0 - AND - debit_type_code IS NOT NULL - } - ); - - # Correct any pathalogical cases - $dbh->do( qq{ - UPDATE - accountlines - SET - credit_type_code = debit_type_code, - debit_type_code = NULL - WHERE - amount < 0 - AND - debit_type_code IS NOT NULL - }); - - # Always end with this (adjust the bug info) - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 73359e5b88..4d273ee03e 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20387,6 +20387,50 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 21633 - Remove finesMode 'test')\n"; } +$DBversion = '19.11.03.004'; +if( CheckVersion( $DBversion ) ) { + + # Add any pathalogical incorrect debit_types as credit_types as appropriate + $dbh->do( + qq{ + INSERT IGNORE INTO account_credit_types ( + code, + description, + can_be_added_manually, + is_system + ) + SELECT + DISTINCT(debit_type_code), + "Unexpected type found during upgrade", + 1, + 0 + FROM + accountlines + WHERE + amount < 0 + AND + debit_type_code IS NOT NULL + } + ); + + # Correct any pathalogical cases + $dbh->do( qq{ + UPDATE + accountlines + SET + credit_type_code = debit_type_code, + debit_type_code = NULL + WHERE + amount < 0 + AND + debit_type_code IS NOT NULL + }); + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24532 - Fix misidentified credit_types from bug 23049 )\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.2