From 0b5e231dd5cbd63a4e00dd3ebfef1479eab60cbf Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 30 Jun 2021 10:18:14 +0200 Subject: [PATCH 1/5] add labels and export only latest prices --- htdocs/core/modules/modProduct.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 3459973a699..dc769451e67 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -322,7 +322,7 @@ class modProduct extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", + $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel", 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC", 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC", @@ -337,7 +337,7 @@ class modProduct extends DolibarrModules // 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean", // 'p.datec'=>'Date','p.tms'=>'Date' //); - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", + $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label", 'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product", 'pr.price_ttc'=>"product", 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product", @@ -348,6 +348,8 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile + $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product)'; + $this->export_sql_end[$r] .= ' ORDER BY p.ref, pr.price_level'; } if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { @@ -356,7 +358,7 @@ class modProduct extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("produit", "export")); - $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", + $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 's.nom'=>'ThirdParty', 'pr.price_base_type'=>"PriceBase", 'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC", @@ -367,7 +369,7 @@ class modProduct extends DolibarrModules if (is_object($mysoc) && $usenpr) { $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR'; } - $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", + $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product", 'p.label'=>"Label", 's.nom'=>'company', 'pr.price_base_type'=>"product", 'pr.price'=>"product", 'pr.price_ttc'=>"product", From 4f2e579bb2c5966a86ea7e33149a35589ea8797a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 30 Jun 2021 10:21:31 +0200 Subject: [PATCH 2/5] add labels and export only latest prices --- htdocs/core/modules/modProduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index dc769451e67..62e355d8e6a 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -348,7 +348,7 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile - $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product)'; + $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product)'; // export only latest prices not full history $this->export_sql_end[$r] .= ' ORDER BY p.ref, pr.price_level'; } From ac6cb5853e7c6406681a4ca7e5d8a5339871e0d5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 30 Jun 2021 15:35:55 +0200 Subject: [PATCH 3/5] fix for multientity --- htdocs/core/modules/modProduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 62e355d8e6a..5b0a1c06b85 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -348,7 +348,7 @@ class modProduct extends DolibarrModules $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile - $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product)'; // export only latest prices not full history + $this->export_sql_end[$r] .= ' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.'product_price as pr2 WHERE pr2.fk_product = pr.fk_product AND pr2.entity IN ('.getEntity('product').'))'; // export only latest prices not full history $this->export_sql_end[$r] .= ' ORDER BY p.ref, pr.price_level'; } From 7c072c7960bf6535e80efe147e49a303b37a54a9 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 2 Jul 2021 10:47:57 +0200 Subject: [PATCH 4/5] Fix Error type ent in fourn/commande/list.php --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c644f9e35a5..bd5686b71f1 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1406,7 +1406,7 @@ if ($resql) { // Type ent if (!empty($arrayfields['typent.code']['checked'])) { print ''; - if (count($typenArray) == 0) { + if (empty($typenArray)) { $typenArray = $formcompany->typent_array(1); } print $typenArray[$obj->typent_code]; From 3bf268796cd415328353c8494241d43a3aeaecfe Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 2 Jul 2021 12:47:42 +0200 Subject: [PATCH 5/5] Fix #18063 : search filter status lost "Back to list" --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index daa943ffee9..f315661b90c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3017,13 +3017,13 @@ class CommandeFournisseur extends CommonOrder $response->warning_delay = $conf->commande->fournisseur->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("SuppliersOrdersToProcess"); $response->labelShort = $langs->trans("Opened"); - $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2&mainmenu=commercial&leftmenu=orders_suppliers'; + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?search_status=1,2&mainmenu=commercial&leftmenu=orders_suppliers'; $response->img = img_object('', "order"); if ($mode === 'awaiting') { $response->label = $langs->trans("SuppliersOrdersAwaitingReception"); $response->labelShort = $langs->trans("AwaitingReception"); - $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?statut=3,4&mainmenu=commercial&leftmenu=orders_suppliers'; + $response->url = DOL_URL_ROOT.'/fourn/commande/list.php?search_status=3,4&mainmenu=commercial&leftmenu=orders_suppliers'; } while ($obj = $this->db->fetch_object($resql)) {