From c116b700180352d5e4c3a6ebe08035bcd6e610ec Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 15 Oct 2019 12:00:24 +0100 Subject: [PATCH] Bug 23049: (follow-up) Handle unexpected types --- .../mysql/atomicupdate/bug_23049_debit.perl | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/installer/data/mysql/atomicupdate/bug_23049_debit.perl b/installer/data/mysql/atomicupdate/bug_23049_debit.perl index fd3faa306f..322b3cc40b 100644 --- a/installer/data/mysql/atomicupdate/bug_23049_debit.perl +++ b/installer/data/mysql/atomicupdate/bug_23049_debit.perl @@ -105,6 +105,29 @@ if ( CheckVersion($DBversion) ) { } ); + # Add any unexpected accounttype codes to debit_types as appropriate + $dbh->do( + qq{ + INSERT IGNORE INTO account_debit_types ( + code, + description, + can_be_added_manually, + default_amount, + is_system + ) + SELECT + SUBSTR(accounttype, 1, 80), + "Unexpected type found during upgrade", + 1, + NULL, + 0 + FROM + accountlines + WHERE + amount > 0 + } + ); + # Adding debit_type_code to accountlines unless ( column_exists('accountlines', 'debit_type_code') ) { $dbh->do( -- 2.20.1