Complete #13708, normalization of code

This commit is contained in:
Laurent Destailleur
2020-04-23 13:21:39 +02:00
parent 4475df14b4
commit 72c6ac1c72
40 changed files with 149 additions and 169 deletions

View File

@@ -3342,7 +3342,7 @@ class Commande extends CommonOrder
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0)
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@@ -3437,14 +3437,11 @@ class Commande extends CommonOrder
if (!$error)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
$result = $this->deleteExtraFields();
if ($result < 0)
{
$result = $this->deleteExtraFields();
if ($result < 0)
{
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
}
@@ -4255,7 +4252,7 @@ class OrderLine extends CommonOrderLine
if ($resql)
{
// Remove extrafields
if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->deleteExtraFields();
@@ -4401,7 +4398,7 @@ class OrderLine extends CommonOrderLine
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet');
$this->rowid = $this->id;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$result = $this->insertExtraFields();
if ($result < 0)
@@ -4534,7 +4531,7 @@ class OrderLine extends CommonOrderLine
$resql = $this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (!$error)
{
$this->id = $this->rowid;
$result = $this->insertExtraFields();