link to go to the second tab and only display orders related to a certain product
This commit is contained in:
parent
c756d34940
commit
44bde866ee
@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -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,
|
||||
'</td>',
|
||||
'<td align="right">',
|
||||
$ordered, ' ', $picto,
|
||||
'<a href="replenishorders.php?sproduct=' , $prod->id, '">',
|
||||
$ordered, '</a> ', $picto,
|
||||
'</td>',
|
||||
'<td align="right">',
|
||||
'<input type="text" name="tobuy' . $i . '" value="' . $stocktobuy . '" ' . $disabled . '>',
|
||||
'<input type="text" name="tobuy' . $i .
|
||||
'" value="' . $stocktobuy . '" ' . $disabled . '>',
|
||||
'</td>',
|
||||
'<td align="right">',
|
||||
$form->select_product_fourn_price($prod->id,
|
||||
|
||||
@ -61,7 +61,7 @@ $sttc = GETPOST('search_ttc', 'int');
|
||||
$sall = GETPOST('search_all', 'alpha');
|
||||
$sdate = GETPOST('search_date', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
|
||||
$sproduct = GETPOST('sproduct', 'int');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
|
||||
@ -259,8 +259,8 @@ if ($resql) {
|
||||
while ($i < min($num,$conf->liste_limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
|
||||
if (!dispatched($obj->rowid)) {
|
||||
if(!dispatched($obj->rowid) &&
|
||||
(!$sproduct || in_array($sproduct, getProducts($obj->rowid)))) {
|
||||
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||
echo '<tr ' . $bc[$var] . '>',
|
||||
// Ref
|
||||
|
||||
Loading…
Reference in New Issue
Block a user