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; + } } /*