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

@ -469,6 +469,8 @@ class Adherent extends CommonObject
$action=''; $action='';
$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))
{
if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -476,6 +478,7 @@ class Adherent extends CommonObject
$error++; $error++;
} }
} }
}
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
// Update password // Update password

View File

@ -270,6 +270,8 @@ class Contact extends CommonObject
$parameters=array('socid'=>$this->id); $parameters=array('socid'=>$this->id);
$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))
{
if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -277,6 +279,7 @@ class Contact extends CommonObject
$error++; $error++;
} }
} }
}
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $error && ! $notrigger) if (! $error && ! $notrigger)

View File

@ -496,6 +496,8 @@ class Product extends CommonObject
$parameters=array('id'=>$this->id); $parameters=array('id'=>$this->id);
$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))
{
if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -503,6 +505,7 @@ class Product extends CommonObject
$error++; $error++;
} }
} }
}
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $error && ! $notrigger) if (! $error && ! $notrigger)

View File

@ -579,6 +579,8 @@ class Societe extends CommonObject
$parameters=array('socid'=>$this->id); $parameters=array('socid'=>$this->id);
$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))
{
if (empty($conf->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -586,6 +588,7 @@ class Societe extends CommonObject
$error++; $error++;
} }
} }
}
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
if (! $error && $call_trigger) if (! $error && $call_trigger)