diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 10bbd8b270b..a54b2bc2ce5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -199,9 +199,26 @@ class ProductFournisseur extends Product dol_syslog(get_class($this).'::update_buyprice sql='.$sql); $resql = $this->db->query($sql); if ($resql) - { - $this->db->commit(); - return 0; + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('UPDATE_BUYPRICE',$this,$user,$langs,$conf); + if ($result < 0) + { + $error++; $this->errors=$interface->errors; + } + + if (empty($error)) + { + $this->db->commit(); + return 0; + } + else + { + $this->db->rollback(); + return 1; + } } else { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index e98ce39bfe9..cd5f69ba95d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -72,6 +72,10 @@ if (! $sortorder) $sortorder="ASC"; /* * Actions */ + +$parameters=array('socid'=>$socid, 'id_prod'=>$id); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); if ($action == 'remove_pf') { @@ -385,6 +389,12 @@ if ($id || $ref) print ''; print ''; } + + if (is_object($hookmanager)) + { + $parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$product->id); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); + } print '';