Skip to content
Snippets Groups Projects
Commit 5dce1686 authored by Florian Henry's avatar Florian Henry
Browse files

Review delete extrafield in delete class method

parent 53ca1546
No related branches found
No related tags found
No related merge requests found
......@@ -2005,6 +2005,21 @@ class Propal extends CommonObject
}
}
// Removed extrafields
if (! $error)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
$errorflag=-4;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
}
}
}
if (! $error)
{
dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG);
......
......@@ -2392,6 +2392,17 @@ class Commande extends CommonOrder
// Delete linked contacts
$res = $this->delete_linked_contact();
if ($res < 0) $error++;
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
// On efface le repertoire de pdf provisoire
$comref = dol_sanitizeFileName($this->ref);
......@@ -2419,6 +2430,8 @@ class Commande extends CommonOrder
}
}
}
}
if (! $error)
......
......@@ -1441,6 +1441,17 @@ class CommandeFournisseur extends CommonOrder
{
$error++;
}
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
if (! $error)
{
......
......@@ -668,6 +668,17 @@ class Product extends CommonObject
}
}
}
// Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{
$result=$this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
if (! $error)
{
......
......@@ -474,6 +474,12 @@ class Project extends CommonObject
}
}
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task_extrafields";
$sql.= " WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task WHERE fk_projet=" . $this->id . ")";
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_task";
$sql.= " WHERE fk_projet=" . $this->id;
......@@ -485,6 +491,13 @@ class Project extends CommonObject
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "projet_extrafields";
$sql.= " WHERE fk_object=" . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
// We remove directory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment