From 96481c3d521327e359890ff8d37c57e5b617b2cc Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 27 Mar 2020 09:42:45 +0100 Subject: [PATCH 1/6] FIX ordered stock already in $stock --- htdocs/product/stock/replenish.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 2ad465bdedb..ae5c936ef1e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -702,7 +702,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) //depending on conf, use either physical stock or //virtual stock to compute the stock to buy value - $stocktobuy = max(max($desiredstock, $alertstock) - $stock - $ordered, 0); + + if(empty($usevirtualstock)) $stocktobuy = max(max($desiredstock, $alertstock) - $stock - $ordered, 0); + else $stocktobuy = max(max($desiredstock, $alertstock) - $stock, 0); //ordered is already in $stock in virtual mode + $disabled = ''; if ($ordered > 0) { From cb7342d4c8a03c87dbc67930a0a789583be063cf Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 27 Mar 2020 20:07:18 +0100 Subject: [PATCH 2/6] FIX product purchase prices Fix get datas but don't fix cleandata :( @eldy --- htdocs/product/class/api_products.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1e189026366..0cf6b344abf 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -796,11 +796,11 @@ class Products extends DolibarrApi } if ($result) { - $this->productsupplier->fetch($id, $ref); - $this->productsupplier->list_product_fournisseur_price($id, '', '', 0, 0); + $product_fourn = new ProductFournisseur($this->db); + $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->product->id, '', '', 0, 0); } - return $this->_cleanObjectDatas($this->productsupplier); + return $this->_cleanObjectDatas($product_fourn_list); } /** From 31fca2897a5cc947b86ecb065d3c9f42fcfccf73 Mon Sep 17 00:00:00 2001 From: Nicolas Bouquet Date: Mon, 30 Mar 2020 10:24:42 +0200 Subject: [PATCH 3/6] FIX: extra date field incorrect check Small typo fixed, was preventing extra date fields from being processed, leading to denial of object creation --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index cf439f210be..0938da39dcd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2150,7 +2150,7 @@ class ExtraFields if (in_array($key_type, array('date', 'datetime'))) { - if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix)."year") continue; // Value was not provided, we should not set it. + if (! GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) continue; // Value was not provided, we should not set it. // Clean parameters $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); } From 076caa11abada04f2298d379d536f32b433e79ed Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 30 Mar 2020 10:28:20 +0200 Subject: [PATCH 4/6] Add token functions to improve modulebuilder compatiblity with maintained versions. --- htdocs/core/lib/functions.lib.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a16faa50f46..bb015117646 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7944,3 +7944,24 @@ function isAFileWithExecutableContent($filename) } return false; } + +/** + * Return the value of token currently saved into session with name 'newtoken'. + * This token must be send by any POST as it will be used by next page for comparison with value in session. + * + * @return string + */ +function newToken() +{ + return $_SESSION['newtoken']; +} + +/** + * Return the value of token currently saved into session with name 'token'. + * + * @return string + */ +function currentToken() +{ + return $_SESSION['token']; +} \ No newline at end of file From 3eda785ca53b1b421df8c25b508aaf1817c473d7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 30 Mar 2020 10:36:49 +0200 Subject: [PATCH 5/6] Add newline end of file --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bb015117646..b73d58115fb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7964,4 +7964,4 @@ function newToken() function currentToken() { return $_SESSION['token']; -} \ No newline at end of file +} From 64207ef58d9ed98e51122788c1008fd0615ef648 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 30 Mar 2020 14:18:05 +0200 Subject: [PATCH 6/6] FIX missing array option --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 829b82a6903..cb2b24badf8 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1213,7 +1213,7 @@ $result = $object->updateline( '', null, null, - array(), + $array_option, $lines[$i]->fk_unit, 0, $element,