FIX update extrafields

This commit is contained in:
Laurent Destailleur
2018-08-12 16:29:26 +02:00
parent e1877625a0
commit 12e21b4886
14 changed files with 90 additions and 70 deletions

View File

@@ -222,7 +222,7 @@ class Fichinter extends CommonObject
if (! $resql) $error++;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)
@@ -285,6 +285,8 @@ class Fichinter extends CommonObject
$this->fk_project = 0;
}
$error = 0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
@@ -299,8 +301,16 @@ class Fichinter extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql))
{
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('FICHINTER_MODIFY',$user);
@@ -372,8 +382,7 @@ class Fichinter extends CommonObject
if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield
// fetch optionals attributes and labels
// Retreive extrafields
$this->fetch_optionals();
/*