Fix: avoid conflicts with external module if triggers used

This commit is contained in:
Regis Houssin 2012-11-09 19:23:46 +01:00
parent afe339a2e2
commit 0e0582c16f
4 changed files with 30 additions and 18 deletions

View File

@ -470,11 +470,14 @@ class Adherent extends CommonObject
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
$result=$this->insertExtraFields(); if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if ($result < 0) {
{ $result=$this->insertExtraFields();
$error++; if ($result < 0)
} {
$error++;
}
}
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;

View File

@ -271,10 +271,13 @@ class Contact extends CommonObject
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
$result=$this->insertExtraFields(); if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if ($result < 0)
{ {
$error++; $result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
} }
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;

View File

@ -497,11 +497,14 @@ class Product extends CommonObject
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
$result=$this->insertExtraFields(); if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if ($result < 0) {
{ $result=$this->insertExtraFields();
$error++; if ($result < 0)
} {
$error++;
}
}
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;

View File

@ -580,11 +580,14 @@ class Societe extends CommonObject
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
$result=$this->insertExtraFields(); if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if ($result < 0) {
{ $result=$this->insertExtraFields();
$error++; if ($result < 0)
} {
$error++;
}
}
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;