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();
@ -131,11 +131,24 @@ class ProductFournisseur extends Product
dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG); dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{
// Call trigger
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
if (empty($error))
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else else
{
$this->db->rollback();
return -1;
}
}
else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->db->rollback(); $this->db->rollback();

View File

@ -95,9 +95,14 @@ if (empty($reshook))
{ {
if ($rowid) if ($rowid)
{ {
$result=$object->remove_product_fournisseur_price($rowid);
$action = ''; $action = '';
$result=$product->remove_product_fournisseur_price($rowid);
if($result > 0){
setEventMessage($langs->trans("PriceRemoved")); setEventMessage($langs->trans("PriceRemoved"));
}else{
$error++;
setEventMessages($product->error, $product->errors, 'errors');
}
} }
} }