From 07e647ca10e6d5afe21faee4839df2356522be3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Sep 2019 14:27:13 +0200 Subject: [PATCH] Fix sql outside transaction --- htdocs/core/class/link.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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;