From 4f5e207f08e68958184febd18882160f22bed143 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 29 Sep 2015 09:45:04 +0200 Subject: [PATCH] review --- htdocs/comm/action/class/actioncomm.class.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8bdee37759b..489262eb1a8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -532,6 +532,7 @@ class ActionComm extends CommonObject $error=0; $this->db->begin(); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; $sql.= " WHERE id=".$this->id; @@ -543,16 +544,18 @@ class ActionComm extends CommonObject $error++; } - $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; - $sql.= " WHERE fk_actioncomm=".$this->id; - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $res=$this->db->query($sql); - if ($res < 0) { - $this->error=$this->db->lasterror(); - $error++; + if (! $error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; + $sql.= " WHERE fk_actioncomm=".$this->id; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $res=$this->db->query($sql); + if ($res < 0) { + $this->error=$this->db->lasterror(); + $error++; + } } - + // Removed extrafields if (! $error) { $result=$this->deleteExtraFields();