diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index 0283c538d53..470ca7fc2e1 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -21,6 +21,7 @@ * \ingroup produit * \brief Contains functions used in replenish.php and replenishorders.php */ +require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; function dispatched($order_id) { @@ -103,4 +104,20 @@ function ordered($product_id) } } +function getProducts($order_id) +{ + global $db; + $order = new CommandeFournisseur($db); + $f = $order->fetch($order_id); + $products = array(); + if($f) { + foreach($order->lines as $line) { + if (!in_array($line->fk_product, $products)) { + $products[] = $line->fk_product; + } + } + } + return $products; +} + ?> diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index b4812a87842..eeb1ec79cd2 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -422,11 +422,14 @@ if ($resql) { //virtual stock to compute the stock to buy value $stocktobuy = max($objp->desiredstock - $stock - $ordered, 0); $disabled = ''; - if ($ordered > 0) { - $picto = img_picto('', './img/yes', '', 1); + if($ordered > 0) { if($ordered + $stock >= $objp->desiredstock) { + $picto = img_picto('', './img/yes', '', 1); $disabled = 'disabled="disabled"'; } + else { + $picto = img_picto('', './img/no', '', 1); + } } else { $picto = img_picto('', './img/no', '', 1); } @@ -458,10 +461,12 @@ if ($resql) { $warning, $stock, '', '