diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4b94f87c65f..dcbb25775e7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7876,6 +7876,7 @@ abstract class CommonObject public function createCommon(User $user, $notrigger = false) { global $langs; + dol_syslog(get_class($this)."::createCommon create", LOG_DEBUG); $error = 0; @@ -8114,6 +8115,7 @@ abstract class CommonObject public function updateCommon(User $user, $notrigger = false) { global $conf, $langs; + dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG); $error = 0; @@ -8203,6 +8205,8 @@ abstract class CommonObject */ public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) { + dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG); + $error = 0; $this->db->begin(); @@ -8260,17 +8264,10 @@ abstract class CommonObject } } - if (!$error && !empty($this->isextrafieldmanaged)) + if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } + $result = $this->deleteExtraFields(); + if ($result < 0) { $error++; } } if (!$error)