From 52eecabbea36b452b4da338bed590adfc05acc28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Feb 2005 21:08:47 +0000 Subject: [PATCH] Fix: On test le update pour valider ou non la transaction. --- htdocs/societe.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 82adbba2ae7..0c78c006eef 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -126,10 +126,17 @@ class Societe { $this->creation_bit = 1; - $result = $this->update($this->id); + $ret = $this->update($this->id); - $this->db->commit(); - return $result; + if ($ret == 0) { + $this->db->commit(); + } else { + dolibarr_syslog("Societe::create echec update"); + $this->db->rollback(); + return -3; + } + + return $ret; } else { @@ -138,7 +145,7 @@ class Societe { $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); } else { - dolibarr_syslog("Societe::Create echec insert sql=$sql"); + dolibarr_syslog("Societe::create echec insert sql=$sql"); } $this->db->rollback(); return -2;