Add trigger "SUPPLIER_PRODUCT_BUYPRICE_DELETE" for frounisseur.product remove_product_fournisseur_price()

This commit is contained in:
All-3kcis 2015-10-21 10:07:53 +02:00
parent 9a1ec900bd
commit ca8c1adf55
2 changed files with 23 additions and 5 deletions

View File

@ -121,7 +121,7 @@ class ProductFournisseur extends Product
*/ */
function remove_product_fournisseur_price($rowid) function remove_product_fournisseur_price($rowid)
{ {
global $conf; global $conf, $user;
$this->db->begin(); $this->db->begin();
@ -132,8 +132,21 @@ class ProductFournisseur extends Product
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->db->commit(); // Call trigger
return 1; $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 else
{ {

View File

@ -95,9 +95,14 @@ if (empty($reshook))
{ {
if ($rowid) if ($rowid)
{ {
$result=$object->remove_product_fournisseur_price($rowid);
$action = ''; $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');
}
} }
} }