From cd1368cb71202231393aeb207ddd9fcd3cdfdf72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 17:10:40 +0200 Subject: [PATCH] Fix dispatch in ledger for various payment done in same account when there is 2 different transaction in 2 different account (backport v12) --- htdocs/accountancy/journal/bankjournal.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e9be75990dc..06f5a56f943 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -666,7 +666,7 @@ if (! $error && $action == 'writebookkeeping') { } elseif ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = $k; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"]; + $bookkeeping->numero_compte = $tabpay[$key]["account_various"]; $accountingaccount->fetch(null, $bookkeeping->numero_compte, true); $bookkeeping->label_compte = $accountingaccount->label; @@ -1174,7 +1174,11 @@ if (empty($action) || $action == 'view') { //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; if (! empty($tabcompany[$key]['code_compta'])) { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + if (in_array($tabtype[$key], array('payment_various'))) { + // For such case, if subledger is not defined, we won't use subledger accounts. + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; + } else { + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } else {