Fix hooks from supplierorder to supplierinvoice

This commit is contained in:
Juanjo Menent 2014-11-06 23:10:21 +01:00
parent 2f30e769f6
commit 3880013940
2 changed files with 14 additions and 7 deletions

View File

@ -255,16 +255,23 @@ class FactureFournisseur extends CommonInvoice
$result=$this->update_price();
if ($result > 0)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierinvoicedao'));
$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))
{
$result=$this->insertExtraFields();
if ($result < 0)
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$error++;
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
}
else if ($reshook < 0) $error++;
// Call trigger
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
if ($result < 0) $error++;

View File

@ -1083,7 +1083,7 @@ elseif ($action == 'update_extras')
{
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('supplierorderdao'));
$hookmanager->initHooks(array('supplierinvoicedao'));
$parameters=array('id'=>$object->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks