From aff7148ed8ad0b62f44ab27dfc335fe4c71976f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Feb 2022 16:39:42 +0100 Subject: [PATCH] Fix missing error management --- htdocs/compta/paiement/class/paiement.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 84d1b007e09..566a83ea400 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -585,16 +585,19 @@ class Paiement extends CommonObject return -1; } - $this->db->begin(); - $this->fk_account = $accountid; + dol_syslog("addPaymentToBank ".$user->id.", ".$mode.", ".$label.", ".$this->fk_account.", ".$emetteur_nom.", ".$emetteur_banque); + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - dol_syslog("$user->id, $mode, $label, $this->fk_account, $emetteur_nom, $emetteur_banque"); - $acc = new Account($this->db); $result = $acc->fetch($this->fk_account); + if ($result < 0) { + $error++; + return -1; + } + + $this->db->begin(); $totalamount = $this->amount; if (empty($totalamount)) {