From 278b708e1729345b1d47f022ec2c55f3cd8651ad Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 11 Apr 2019 11:57:50 +0200 Subject: [PATCH 01/31] use subproducts costprice and pmp if empty on father --- htdocs/fourn/ajax/getSupplierPrices.php | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 85b0ed37155..57874e3a122 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,12 +86,46 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; + if (empty($price)) + { + // get costprice for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->cost_price; + } + } + } + $prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() if(!empty($conf->stock->enabled)) { // Add price for pmp $price=$producttmp->pmp; + if (empty($price)) + { + // get pmp for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->pmp; + } + } + } + $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } } From 30ad0e7e11260d089d30743f1536ab4248031fc8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 09:00:39 +0200 Subject: [PATCH 02/31] introduce PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY --- htdocs/fourn/ajax/getSupplierPrices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 57874e3a122..211734f1129 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,7 +86,7 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; - if (empty($price)) + if (empty($price) && ! empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) { // get costprice for subproducts if any $producttmp->get_sousproduits_arbo(); From e87fb1c0dc80aedd63ef6565d31a8d0eee7ffaec Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 7 Jan 2022 12:19:03 +0100 Subject: [PATCH 03/31] add column into table inst --- htdocs/install/mysql/tables/llx_projet_task_time.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_projet_task_time.sql b/htdocs/install/mysql/tables/llx_projet_task_time.sql index 786d8907588..63eadb1177f 100644 --- a/htdocs/install/mysql/tables/llx_projet_task_time.sql +++ b/htdocs/install/mysql/tables/llx_projet_task_time.sql @@ -24,6 +24,7 @@ create table llx_projet_task_time task_datehour datetime, -- day + hour task_date_withhour integer DEFAULT 0, -- 0 by default, 1 if date was entered with start hour task_duration double, + fk_product integer NULL, fk_user integer, thm double(24,8), invoice_id integer DEFAULT NULL, -- If we need to invoice each line of timespent, we can save invoice id here From f5788bef669dfc72407e7237e6bc6927268071b3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 7 Jan 2022 12:20:27 +0100 Subject: [PATCH 04/31] OK BDD --- .../install/mysql/migration/15.0.0-16.0.0.sql | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 htdocs/install/mysql/migration/15.0.0-16.0.0.sql diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql new file mode 100644 index 00000000000..64df9ca79cb --- /dev/null +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -0,0 +1,34 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 14.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table; +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex; +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: +-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); + + +-- Missing in v14 or lower +ALTER TABLE llx_projet_task_time ADD COLUMN fk_product integer NULL; From 2d9c46ed3aeef2772c8f9293049cd05dfa29cbe3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 12 Jan 2022 12:22:43 +0100 Subject: [PATCH 05/31] NEW pre-filled extra fields with slected credit note --- htdocs/compta/facture/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 03b14416587..caef83ad025 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3415,6 +3415,10 @@ if ($action == 'create') { $optionsav .= '