From 8e63baeeab889e7f5c93152ef251566af1c28935 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Apr 2023 04:50:40 +0200 Subject: [PATCH] Debug v18 --- htdocs/compta/bank/transfer.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 724e09554db..62e85558ed1 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -114,13 +114,13 @@ if ($action == 'add') { if (!$errori[$n]) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $accountfrom = new Account($db); - $accountfrom->fetch(GETPOST($n.'_account_from', 'int')); + $tmpaccountfrom = new Account($db); + $tmpaccountfrom->fetch(GETPOST($n.'_account_from', 'int')); - $accountto = new Account($db); - $accountto->fetch(GETPOST($n.'_account_to', 'int')); + $tmpaccountto = new Account($db); + $tmpaccountto->fetch(GETPOST($n.'_account_to', 'int')); - if ($accountto->currency_code == $accountfrom->currency_code) { + if ($tmpaccountto->currency_code == $tmpaccountfrom->currency_code) { $amountto[$n] = $amount[$n]; } else { if (!$amountto[$n]) { @@ -133,7 +133,7 @@ if ($action == 'add') { setEventMessages($langs->trans("AmountMustBePositive").' #'.$n, null, 'errors'); } - if ($accountto->id == $accountfrom->id) { + if ($tmpaccountto->id == $tmpaccountfrom->id) { $errori[$n]++; setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers").' #'.$n, null, 'errors'); } @@ -149,45 +149,45 @@ if ($action == 'add') { // By default, electronic transfert from bank to bank $typefrom = $type[$n]; $typeto = $type[$n]; - if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH) { + if ($tmpaccountto->courant == Account::TYPE_CASH || $tmpaccountfrom->courant == Account::TYPE_CASH) { // This is transfer of change $typefrom = 'LIQ'; $typeto = 'LIQ'; } if (!$errori[$n]) { - $bank_line_id_from = $accountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * $amount[$n]), '', '', $user); + $bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * $amount[$n]), '', '', $user); } if (!($bank_line_id_from > 0)) { $errori[$n]++; } if (!$errori[$n]) { - $bank_line_id_to = $accountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', '', $user); + $bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', '', $user); } if (!($bank_line_id_to > 0)) { $errori[$n]++; } if (!$errori[$n]) { - $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); + $result = $tmpaccountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); } if (!($result > 0)) { $errori++; } if (!$errori[$n]) { - $result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); + $result = $tmpaccountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert'); } if (!($result > 0)) { $errori[$n]++; } if (!$errori[$n]) { $mesgs = $langs->trans("TransferFromToDone", '{s1}', '{s2}', $amount[$n], $langs->transnoentitiesnoconv("Currency".$conf->currency)); - $mesgs = str_replace('{s1}', ''.$accountfrom->label.'', $mesgs); - $mesgs = str_replace('{s2}', ''.$accountto->label.'', $mesgs); + $mesgs = str_replace('{s1}', ''.$tmpaccountfrom->label.'', $mesgs); + $mesgs = str_replace('{s2}', ''.$tmpaccountto->label.'', $mesgs); setEventMessages($mesgs, null, 'mesgs'); $db->commit(); } else { - setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors'); + setEventMessages($tmpaccountfrom->error.' '.$tmpaccountto->error, null, 'errors'); $db->rollback(); } }