Commonobject : delete extrafields + syslog

This commit is contained in:
Maxime Kohlhaas 2020-04-13 19:02:19 +02:00
parent 26befa3b93
commit 2e004e93ea

View File

@ -7876,6 +7876,7 @@ abstract class CommonObject
public function createCommon(User $user, $notrigger = false) public function createCommon(User $user, $notrigger = false)
{ {
global $langs; global $langs;
dol_syslog(get_class($this)."::createCommon create", LOG_DEBUG);
$error = 0; $error = 0;
@ -8114,6 +8115,7 @@ abstract class CommonObject
public function updateCommon(User $user, $notrigger = false) public function updateCommon(User $user, $notrigger = false)
{ {
global $conf, $langs; global $conf, $langs;
dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG);
$error = 0; $error = 0;
@ -8203,6 +8205,8 @@ abstract class CommonObject
*/ */
public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0)
{ {
dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG);
$error = 0; $error = 0;
$this->db->begin(); $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"; $result = $this->deleteExtraFields();
$sql .= " WHERE fk_object=".$this->id; if ($result < 0) { $error++; }
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errors[] = $this->db->lasterror();
$error++;
}
} }
if (!$error) if (!$error)