diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ec74b836e1c..0d6bebada72 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -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++; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4f1583f6b61..38a0f79a6ea 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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