Merge pull request #3784 from All-3kcis/develop-patch-11
NEW Add trigger "SUPPLIER_PRODUCT_BUYPRICE_DELETE"
This commit is contained in:
commit
72915aa16d
@ -121,26 +121,38 @@ 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();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
// Call trigger
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_DELETE',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG);
|
if (empty($error))
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||||
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (!$resql)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($error)){
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}else{
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user