Remove hook that is duplicate code with trigger.
This commit is contained in:
parent
0f22beb774
commit
9928f943a7
@ -1237,7 +1237,7 @@ class User extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0)
|
function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $hookmanager;
|
global $conf, $langs;
|
||||||
|
|
||||||
$nbrowsaffected=0;
|
$nbrowsaffected=0;
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -1412,22 +1412,14 @@ class User extends CommonObject
|
|||||||
$action='update';
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
$hookmanager->initHooks(array('userdao'));
|
|
||||||
$parameters=array('socid'=>$this->id);
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -624,22 +624,14 @@ class UserGroup extends CommonObject
|
|||||||
$action='create';
|
$action='create';
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
$hookmanager->initHooks(array('groupdao'));
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
@ -695,22 +687,14 @@ class UserGroup extends CommonObject
|
|||||||
$action='update';
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
$hookmanager->initHooks(array('groupdao'));
|
|
||||||
$parameters=array();
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
$result=$this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$error++;
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user