From 1e45b9b1cd5f0b6c934a3b275c225ec6d3da7e8a Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 25 Oct 2021 15:25:58 +0200 Subject: [PATCH 1/6] FIX : We need a default price base type in variant creation case with multiprices when parent has been created with only one level price --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index bc479b68653..10318f11a46 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -509,7 +509,7 @@ class ProductCombination for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if ($parent->multiprices[$i] != '' || isset($this->combination_price_levels[$i]->variation_price)) { - $new_type = $parent->multiprices_base_type[$i]; + $new_type = !empty($parent->multiprices_base_type[$i]) ? $parent->multiprices_base_type[$i] : 'HT'; $new_min_price = $parent->multiprices_min[$i]; $variation_price = doubleval(!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price); $variation_price_percentage = doubleval(!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage); From c998abe54e36977b8144936c4587919eff2dab21 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 27 Oct 2021 11:09:00 +0200 Subject: [PATCH 2/6] FIX: resource list : Use standard code to handle list filters --- htdocs/resource/list.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 033d49ae8c8..a4721b2d174 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -75,22 +75,16 @@ if ($search_type != '') { } // Add $param from extra fields -foreach ($search_array_options as $key => $val) -{ - $crit = $val; - $tmpkey = preg_replace('/search_options_/', '', $key); - $typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey]; - if ($val != '') { - $param .= '&search_options_'.$tmpkey.'='.urlencode($val); - } - $mode_search = 0; - if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int - if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) - { - $filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +$sql= null; +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + +// Including the previous script generate the correct SQL filter for all the extrafields +// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake +// extrafields filter key to make it works +$filter['ef.resource'] = $sql; + + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); From cee573cf96094cee86453f0553cb542573d502dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Oct 2021 17:42:43 +0100 Subject: [PATCH 3/6] Update ProductCombination.class.php --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 10318f11a46..336503056f9 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -509,7 +509,7 @@ class ProductCombination for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if ($parent->multiprices[$i] != '' || isset($this->combination_price_levels[$i]->variation_price)) { - $new_type = !empty($parent->multiprices_base_type[$i]) ? $parent->multiprices_base_type[$i] : 'HT'; + $new_type = empty($parent->multiprices_base_type[$i]) ? 'HT' : $parent->multiprices_base_type[$i]; $new_min_price = $parent->multiprices_min[$i]; $variation_price = doubleval(!isset($this->combination_price_levels[$i]->variation_price) ? $this->variation_price : $this->combination_price_levels[$i]->variation_price); $variation_price_percentage = doubleval(!isset($this->combination_price_levels[$i]->variation_price_percentage) ? $this->variation_price_percentage : $this->combination_price_levels[$i]->variation_price_percentage); From dd8d4e9e983c5650f31db1386fdb698ee668f315 Mon Sep 17 00:00:00 2001 From: ATM john Date: Thu, 4 Nov 2021 12:10:19 +0100 Subject: [PATCH 4/6] Fix missing return status --- htdocs/core/db/DoliDB.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 8f2a9dc315e..af470ac62d6 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -308,7 +308,7 @@ abstract class DoliDB implements Database * Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries * Dont add LIMIT to your query, it will be added by this method * @param string $sql the sql query string - * @return bool| object + * @return bool|int|object false on failure, 0 on empty, object on success */ public function getRow($sql) { @@ -317,7 +317,13 @@ abstract class DoliDB implements Database $res = $this->query($sql); if ($res) { - return $this->fetch_object($res); + $obj = $this->fetch_object($res); + if(!$obj){ + return 0; + } + else{ + return $obj; + } } return false; From 3959d12a39bf5022c6436b493b6de4be77f754fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Nov 2021 12:42:42 +0100 Subject: [PATCH 5/6] Update DoliDB.class.php --- htdocs/core/db/DoliDB.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index af470ac62d6..68e29f22481 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -312,17 +312,15 @@ abstract class DoliDB implements Database */ public function getRow($sql) { - $sql .= ' LIMIT 1;'; + $sql .= ' LIMIT 1'; $res = $this->query($sql); - if ($res) - { + if ($res) { $obj = $this->fetch_object($res); - if(!$obj){ - return 0; - } - else{ + if ($obj) { return $obj; + } else { + return 0; } } From 19b9412c1357299940c14be206bf464fc774cd61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Nov 2021 12:49:33 +0100 Subject: [PATCH 6/6] FIX #19305 --- htdocs/core/modules/modPropale.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 007e92e4277..12835530bf9 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -156,7 +156,8 @@ class modPropale extends DolibarrModules $this->rights[$r][1] = 'Close commercial proposals'; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut - $this->rights[$r][4] = 'cloturer'; + $this->rights[$r][4] = 'propal_advance'; + $this->rights[$r][5] = 'close'; $r++; $this->rights[$r][0] = 27; // id de la permission