diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 47634408a97..7a9373d59db 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2168,7 +2168,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')); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 164b3d2152b..d70f26f3920 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1241,7 +1241,7 @@ if (empty($reshook)) '', null, null, - array(), + $array_option, $lines[$i]->fk_unit, 0, $element, diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index d7d72e28b7c..57964271e47 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -861,11 +861,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); } /** diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d860640be81..0338a63745c 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) {