From ee84870d972c5339bf7d3311c8d057a63eef1f0c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 15 Oct 2019 12:00:41 +0100 Subject: [PATCH] Bug 23049: (follow-up) Handle unexpected types https://bugs.koha-community.org/show_bug.cgi?id=23805 --- .../mysql/atomicupdate/bug_23805_credit.perl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/installer/data/mysql/atomicupdate/bug_23805_credit.perl b/installer/data/mysql/atomicupdate/bug_23805_credit.perl index 27896d0313..f914b85cdd 100644 --- a/installer/data/mysql/atomicupdate/bug_23805_credit.perl +++ b/installer/data/mysql/atomicupdate/bug_23805_credit.perl @@ -101,6 +101,27 @@ if ( CheckVersion($DBversion) ) { } ); + # Add any unexpected accounttype codes to credit_types as appropriate + $dbh->do( + qq{ + INSERT IGNORE INTO account_credit_types ( + code, + description, + can_be_added_manually, + is_system + ) + SELECT + SUBSTR(accounttype, 1, 80), + "Unexpected type found during upgrade", + 1, + 0 + FROM + accountlines + WHERE + amount < 0 + } + ); + # Populating credit_type_code $dbh->do( qq{ -- 2.20.1