From 3f839c2a961f204fddfc74ab4cbe4f25758596f9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Mon, 26 Oct 2020 16:11:21 +0100 Subject: [PATCH] FIX: product customer prices: missing triggers in CRUD class --- .../class/productcustomerprice.class.php | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 8405120ddef..7e77154fb32 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -219,15 +219,11 @@ class Productcustomerprice extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_customer_price"); if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_CREATE', $user); - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + if ($result < 0) { + $error++; + } } } @@ -714,12 +710,11 @@ class Productcustomerprice extends CommonObject if (! $error) { if (! $notrigger) { - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE', $this, $user, $langs, $conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_UPDATE', $user); + + if ($result < 0) { + $error++; + } } } @@ -854,15 +849,11 @@ class Productcustomerprice extends CommonObject if (! $error) { if (! $notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_DELETE', $user); - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + if ($result < 0) { + $error++; + } } }