diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 4ad6b9d5d9a..a5242c597c4 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -365,13 +365,17 @@ class Link extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $error = 0; + $this->db->begin(); + // Call trigger $result=$this->call_trigger('LINK_DELETE', $user); - if ($result < 0) return -1; + if ($result < 0) + { + $this->db->rollback(); + return -1; + } // End call triggers - $this->db->begin(); - // Remove link $sql = "DELETE FROM " . MAIN_DB_PREFIX . "links"; $sql.= " WHERE rowid = " . $this->id;