diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index e1d833d7765..ace6ad548f4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -37,6 +37,31 @@ $langs->load("orders"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service'); +function ordered($product_id) { + global $db; + $sql = 'SELECT DISTINCT cfd.fk_product from '; + $sql .= MAIN_DB_PREFIX.'commande_fournisseurdet as cfd LEFT JOIN '; + $sql .= MAIN_DB_PREFIX.'commande_fournisseur as cf ON '; + $sql .= 'cfd.fk_commande = cf.rowid WHERE cf.source = 42 '; + $sql .= 'AND cf.fk_statut < 5 AND cfd.fk_product = '.$product_id; + + $resql = $db->query($sql); + if($resql) { + $exists = $db->num_rows($resql); + if($exists) { + return img_picto('','tick'); + } + else { + return img_picto('', 'stcomm-1'); + } + } + else { + $error=$db->lasterror(); + dol_print_error($db); + dol_syslog("replenish.php: ".$error, LOG_ERROR); + return $langs->trans('error'); + } +} $action=GETPOST('action','alpha'); $sref=GETPOST("sref"); @@ -294,6 +319,7 @@ if ($resql) print_liste_field_titre($langs->trans("PhysicalStock"),"replenish.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("StockToBuy"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ordered"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Supplier"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder); print ' '; print "\n"; @@ -317,6 +343,7 @@ if ($resql) print ' '; print ' '; print ' '; + print ' '; print ''; print ''; print ''; @@ -392,6 +419,9 @@ if ($resql) $stocktobuy = $objp->desiredstock - $stock; print ''.$stocktobuy.''; print ''; + print ''; + print ordered($product_static->id); + print ''; $form = new Form($db); print ''.$form->select_product_fourn_price($product_static->id, "fourn".$i).''; print ' ';