From 453141fe18d26eb1850e1aaa17edebb1e4c5a196 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Aug 2005 20:26:09 +0000 Subject: [PATCH] =?UTF-8?q?Qual:=20Mise=20en=20transaction=20de=20l'ajout?= =?UTF-8?q?=20d'=E9critures=20bancaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/bank/account.class.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 292edc6b6e4..826a11f3422 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -133,12 +133,14 @@ class Account /** * \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank - * \return int rowid de l'entrée ajoutée, < 0 si erreur + * \return int rowid de l'entrée ajoutée, <0 si erreur */ function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='') { + dolibarr_syslog("Account::addline: $date, $oper, $label, $amount, $num_chq, $categorie, $user"); if ($this->rowid) { + $this->db->begin(); switch ($oper) { @@ -179,17 +181,26 @@ class Account $result = $this->db->query($sql); if (! $result) { - return -2; + $this->db->rollback(); + $this->error=$this->db->error(); + return -3; } } + $this->db->commit(); return $rowid; } else { - dolibarr_print_error($this->db); - return -1; + $this->db->rollback(); + $this->error=$this->db->error(); + return -2; } } + else + { + $this->error="Account::addline rowid not defined"; + return -1; + } } /*