From bf0f6a2b8f9e78a7548f27a6430d187b0e9f08b7 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 20 Feb 2020 08:45:29 +0000 Subject: [PATCH] Bug 24532: DBRev 19.12.00.027 Signed-off-by: Martin Renvoize --- 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 3efb8b17a4..ee5ba350b8 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.026"; +$VERSION = "19.12.00.027"; 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 d2d8f7a9d9..b1db5b15cd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -20860,6 +20860,50 @@ if( CheckVersion( $DBversion ) ) { print "Upgrade to $DBversion done (Bug 11297 - Add support for custom PQF attributes for Z39.50 server searches)\n"; } +$DBversion = '19.12.00.027'; +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 pathological cases of negative debits)\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