diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 490b5cf1ea3..346f69a4cef 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -121,7 +121,7 @@ class ProductFournisseur extends Product */ function remove_product_fournisseur_price($rowid) { - global $conf; + global $conf, $user; $this->db->begin(); @@ -132,8 +132,21 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $this->db->commit(); - return 1; + // Call trigger + $result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + + if (empty($error)) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + return -1; + } } else { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 72f8ed2b0b2..526b67b123c 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -95,9 +95,14 @@ if (empty($reshook)) { if ($rowid) { - $result=$object->remove_product_fournisseur_price($rowid); $action = ''; - setEventMessage($langs->trans("PriceRemoved")); + $result=$product->remove_product_fournisseur_price($rowid); + if($result > 0){ + setEventMessage($langs->trans("PriceRemoved")); + }else{ + $error++; + setEventMessages($product->error, $product->errors, 'errors'); + } } }