Fix: Param $action was not defined.
A better fix must be done later be removing useless hooks that are duplicate with triggers.
This commit is contained in:
parent
ec4b29c65d
commit
c186f13218
@ -465,7 +465,10 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
$nbrowsaffected+=$this->db->affected_rows($resql);
|
$nbrowsaffected+=$this->db->affected_rows($resql);
|
||||||
|
|
||||||
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields (by external module)
|
// Actions on extra fields (by external module)
|
||||||
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('memberdao'));
|
$hookmanager->initHooks(array('memberdao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
$action='';
|
$action='';
|
||||||
|
|||||||
@ -198,11 +198,13 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('HookModuleNamedao'));
|
$hookmanager->initHooks(array('HookModuleNamedao'));
|
||||||
$parameters=array('socid'=>$this->id);
|
$parameters=array('socid'=>$this->id);
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,'create'); // 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->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
@ -289,12 +291,14 @@ class Categorie extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
$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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('HookCategorydao'));
|
$hookmanager->initHooks(array('HookCategorydao'));
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,'update'); // Note that $action and $object may have been modified by some hooks
|
$action='update';
|
||||||
|
$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->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
|
|||||||
@ -241,7 +241,10 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
||||||
$hookmanager->initHooks(array('actioncommdao'));
|
$hookmanager->initHooks(array('actioncommdao'));
|
||||||
$parameters=array('actcomm'=>$this->id);
|
$parameters=array('actcomm'=>$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
|
||||||
@ -560,8 +563,10 @@ class ActionComm extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
$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 !!
|
||||||
$hookmanager->initHooks(array('actioncommdao'));
|
$hookmanager->initHooks(array('actioncommdao'));
|
||||||
$parameters=array('actcomm'=>$this->id);
|
$parameters=array('actcomm'=>$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
|
||||||
|
|||||||
@ -846,6 +846,8 @@ class Propal extends CommonObject
|
|||||||
$resql=$this->update_price(1);
|
$resql=$this->update_price(1);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
$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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('propaldao'));
|
$hookmanager->initHooks(array('propaldao'));
|
||||||
@ -1264,6 +1266,8 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update_extrafields($user)
|
function update_extrafields($user)
|
||||||
{
|
{
|
||||||
|
$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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('propaldao'));
|
$hookmanager->initHooks(array('propaldao'));
|
||||||
@ -2879,7 +2883,7 @@ class PropaleLigne extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog("PropaleLigne::insert rang=".$this->rang);
|
dol_syslog(get_class($this)."::insert rang=".$this->rang);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||||
|
|||||||
@ -801,6 +801,8 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('orderdao'));
|
$hookmanager->initHooks(array('orderdao'));
|
||||||
@ -2928,6 +2930,8 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
function update_extrafields($user)
|
function update_extrafields($user)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('orderdao'));
|
$hookmanager->initHooks(array('orderdao'));
|
||||||
@ -3280,7 +3284,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog("OrderLine::insert rang=".$this->rang);
|
dol_syslog(get_class($this)."::insert rang=".$this->rang);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||||
|
|||||||
@ -464,6 +464,8 @@ class Facture extends CommonInvoice
|
|||||||
$result=$this->update_price(1);
|
$result=$this->update_price(1);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('invoicedao'));
|
$hookmanager->initHooks(array('invoicedao'));
|
||||||
|
|||||||
@ -283,6 +283,8 @@ class Contact extends CommonObject
|
|||||||
unset($this->state_code);
|
unset($this->state_code);
|
||||||
unset($this->state);
|
unset($this->state);
|
||||||
|
|
||||||
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
$hookmanager->initHooks(array('contactdao'));
|
$hookmanager->initHooks(array('contactdao'));
|
||||||
$parameters=array('socid'=>$this->id);
|
$parameters=array('socid'=>$this->id);
|
||||||
|
|||||||
@ -953,6 +953,8 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('supplierorderdao'));
|
$hookmanager->initHooks(array('supplierorderdao'));
|
||||||
|
|||||||
@ -255,6 +255,8 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$result=$this->update_price();
|
$result=$this->update_price();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
$action='create';
|
||||||
|
|
||||||
// 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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('supplierinvoicedao'));
|
$hookmanager->initHooks(array('supplierinvoicedao'));
|
||||||
|
|||||||
@ -680,6 +680,8 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$action='update';
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
$hookmanager->initHooks(array('productdao'));
|
$hookmanager->initHooks(array('productdao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
|
|||||||
@ -878,6 +878,8 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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 !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('thirdpartydao'));
|
$hookmanager->initHooks(array('thirdpartydao'));
|
||||||
|
|||||||
@ -1265,7 +1265,10 @@ class User extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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 !!
|
||||||
$hookmanager->initHooks(array('userdao'));
|
$hookmanager->initHooks(array('userdao'));
|
||||||
$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
|
||||||
|
|||||||
@ -620,16 +620,10 @@ class UserGroup extends CommonObject
|
|||||||
|
|
||||||
if ($this->update(1) < 0) return -2;
|
if ($this->update(1) < 0) return -2;
|
||||||
|
|
||||||
if (! $notrigger)
|
$action='create';
|
||||||
{
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('GROUP_CREATE',$user);
|
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 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 !!
|
||||||
$hookmanager->initHooks(array('groupdao'));
|
$hookmanager->initHooks(array('groupdao'));
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$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
|
||||||
@ -646,6 +640,14 @@ class UserGroup extends CommonObject
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('GROUP_CREATE',$user);
|
||||||
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if ($error > 0) { $error++; $this->db->rollback(); return -1; }
|
if ($error > 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
else $this->db->commit();
|
else $this->db->commit();
|
||||||
|
|
||||||
@ -689,15 +691,10 @@ class UserGroup extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
$action='update';
|
||||||
{
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('GROUP_MODIFY',$user);
|
|
||||||
if ($result < 0) { $error++; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 !!
|
||||||
$hookmanager->initHooks(array('groupdao'));
|
$hookmanager->initHooks(array('groupdao'));
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$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
|
||||||
@ -714,6 +711,14 @@ class UserGroup extends CommonObject
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('GROUP_MODIFY',$user);
|
||||||
|
if ($result < 0) { $error++; }
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user