From 3299e5f88906bab19d6d53aa86ead716d4bd2648 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 26 Mar 2017 19:13:10 +0200 Subject: [PATCH 1/5] PRODUCT_PRICE_SUPPLIER_NO_LOG test inverted if PRODUCT_PRICE_SUPPLIER_NO_LOG is empty, no log is stored if PRODUCT_PRICE_SUPPLIER_NO_LOG is not empty log is stored they are inversion @eldy maybe add more field in this table --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index eaff46ddc2c..94034408e49 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -310,7 +310,7 @@ class ProductFournisseur extends Product $error++; } - if (! $error && ! empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { + if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) { // Add record into log table $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log("; $sql .= "datec, fk_product_fournisseur,fk_user,price,quantity)"; From d8018f7937c2ae4c9a499df2eae9591876461735 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 26 Mar 2017 19:16:19 +0200 Subject: [PATCH 2/5] add trigger on product price add/update --- .../product/class/productcustomerprice.class.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index fd36c55dcf9..9c2ce3e99d2 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -669,15 +669,12 @@ 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. - - // // Call triggers - // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - // $interface=new Interfaces($this->db); - // $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CUSTOMER_PRODUCT_SELLPRICE_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers } } From d60f1d8402a085c54953af11471016f0383689a7 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 26 Mar 2017 19:29:16 +0200 Subject: [PATCH 3/5] add price_level on product_customer_price_log fk_soc can be 0 when generic price is stored on log --- htdocs/install/mysql/tables/llx_product_customer_price_log.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql index 699060cdc98..1d728dd2486 100644 --- a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql +++ b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql @@ -24,7 +24,8 @@ create table llx_product_customer_price_log entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, fk_product integer NOT NULL, - fk_soc integer NOT NULL, + fk_soc integer DEFAULT 0 NOT NULL, + price_level smallint NULL DEFAULT 1, price double(24,8) DEFAULT 0, price_ttc double(24,8) DEFAULT 0, price_min double(24,8) DEFAULT 0, From 9871bc3d9a006e6275eebbdaf6c0a6f78ad1bc92 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sun, 26 Mar 2017 19:35:00 +0200 Subject: [PATCH 4/5] Update 5.0.0-6.0.0.sql --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 25145dc7cfe..bdc2630a4c4 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -25,6 +25,8 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_product_customer_price_log ADD COLUMN price_level smallint default 1; + ALTER TABLE llx_ecm_files ADD COLUMN ref varchar(128) AFTER rowid; ALTER TABLE llx_ecm_files CHANGE COLUMN fullpath filepath varchar(255); ALTER TABLE llx_ecm_files CHANGE COLUMN filepath filepath varchar(255); From 7d57cd691356abe2777868305f58437d2eca825d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Aug 2017 11:38:32 +0200 Subject: [PATCH 5/5] Update productcustomerprice.class.php --- htdocs/product/class/productcustomerprice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 9c2ce3e99d2..89497b68315 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -672,7 +672,7 @@ class Productcustomerprice extends CommonObject // Call triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CUSTOMER_PRODUCT_SELLPRICE_CREATE',$this,$user,$langs,$conf); + $result=$interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // End call triggers }