From ff37e4286ac3c6857493bf27e77117ae2d8a71b3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 28 May 2010 08:30:39 +0000 Subject: [PATCH] Fix: prendre en compte les erreurs des triggers dans la fonction, ne pas faire de retour d'erreurs a partir du trigger pour ne pas les prendre en compte. --- htdocs/comm/propal/class/propal.class.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4d1237245fd..20e3ae16177 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1601,6 +1601,8 @@ class Propal extends CommonObject function delete($user, $notrigger=0) { global $conf,$langs; + + $error=0; $this->db->begin(); @@ -1657,10 +1659,18 @@ class Propal extends CommonObject if ($result < 0) { $error++; $this->errors=$interface->errors; } // End call triggers } - - dol_syslog("Suppression de la proposition $this->id par $user->id", LOG_DEBUG); - $this->db->commit(); - return 1; + + if (!$error) + { + dol_syslog("Suppression de la proposition $this->id par $user->id", LOG_DEBUG); + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return 0; + } } else {