From ea74c4738e8e22593b4fcfe321eb441ec76166f5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 1 Apr 2014 10:23:57 +0200 Subject: [PATCH 1/2] add trigger CREATE_BUYPRICE --- .../fourn/class/fournisseur.product.class.php | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index a54b2bc2ce5..8465f94813d 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -199,7 +199,7 @@ class ProductFournisseur extends Product dol_syslog(get_class($this).'::update_buyprice sql='.$sql); $resql = $this->db->query($sql); if ($resql) - { + { // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($this->db); @@ -208,7 +208,7 @@ class ProductFournisseur extends Product { $error++; $this->errors=$interface->errors; } - + if (empty($error)) { $this->db->commit(); @@ -286,8 +286,25 @@ class ProductFournisseur extends Product if (! $error) { - $this->db->commit(); - return 0; + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CREATE_BUYPRICE',$this,$user,$langs,$conf); + if ($result < 0) + { + $error++; $this->errors=$interface->errors; + } + + if (empty($error)) + { + $this->db->commit(); + return 0; + } + else + { + $this->db->rollback(); + return 1; + } } else { From fff9bc1b0062e6ca17a8c46de1736800769ec34e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 1 Apr 2014 11:14:54 +0200 Subject: [PATCH 2/2] fix bad attribute name --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 8465f94813d..5f38030990c 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -206,7 +206,7 @@ class ProductFournisseur extends Product $result=$interface->run_triggers('UPDATE_BUYPRICE',$this,$user,$langs,$conf); if ($result < 0) { - $error++; $this->errors=$interface->errors; + $error++; $this->error=$interface->errors; } if (empty($error)) @@ -292,7 +292,7 @@ class ProductFournisseur extends Product $result=$interface->run_triggers('CREATE_BUYPRICE',$this,$user,$langs,$conf); if ($result < 0) { - $error++; $this->errors=$interface->errors; + $error++; $this->error=$interface->errors; } if (empty($error))