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
|
* \ingroup produit
|
||||||
* \brief Contains functions used in replenish.php and replenishorders.php
|
* \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)
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -423,10 +423,13 @@ if ($resql) {
|
|||||||
$stocktobuy = max($objp->desiredstock - $stock - $ordered, 0);
|
$stocktobuy = max($objp->desiredstock - $stock - $ordered, 0);
|
||||||
$disabled = '';
|
$disabled = '';
|
||||||
if($ordered > 0) {
|
if($ordered > 0) {
|
||||||
$picto = img_picto('', './img/yes', '', 1);
|
|
||||||
if($ordered + $stock >= $objp->desiredstock) {
|
if($ordered + $stock >= $objp->desiredstock) {
|
||||||
|
$picto = img_picto('', './img/yes', '', 1);
|
||||||
$disabled = 'disabled="disabled"';
|
$disabled = 'disabled="disabled"';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$picto = img_picto('', './img/no', '', 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$picto = img_picto('', './img/no', '', 1);
|
$picto = img_picto('', './img/no', '', 1);
|
||||||
}
|
}
|
||||||
@ -458,10 +461,12 @@ if ($resql) {
|
|||||||
$warning, $stock,
|
$warning, $stock,
|
||||||
'</td>',
|
'</td>',
|
||||||
'<td align="right">',
|
'<td align="right">',
|
||||||
$ordered, ' ', $picto,
|
'<a href="replenishorders.php?sproduct=' , $prod->id, '">',
|
||||||
|
$ordered, '</a> ', $picto,
|
||||||
'</td>',
|
'</td>',
|
||||||
'<td align="right">',
|
'<td align="right">',
|
||||||
'<input type="text" name="tobuy' . $i . '" value="' . $stocktobuy . '" ' . $disabled . '>',
|
'<input type="text" name="tobuy' . $i .
|
||||||
|
'" value="' . $stocktobuy . '" ' . $disabled . '>',
|
||||||
'</td>',
|
'</td>',
|
||||||
'<td align="right">',
|
'<td align="right">',
|
||||||
$form->select_product_fourn_price($prod->id,
|
$form->select_product_fourn_price($prod->id,
|
||||||
|
|||||||
@ -61,7 +61,7 @@ $sttc = GETPOST('search_ttc', 'int');
|
|||||||
$sall = GETPOST('search_all', 'alpha');
|
$sall = GETPOST('search_all', 'alpha');
|
||||||
$sdate = GETPOST('search_date', 'alpha');
|
$sdate = GETPOST('search_date', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
|
$sproduct = GETPOST('sproduct', 'int');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
|
|
||||||
@ -259,8 +259,8 @@ if ($resql) {
|
|||||||
while ($i < min($num,$conf->liste_limit)) {
|
while ($i < min($num,$conf->liste_limit)) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var = !$var;
|
$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;
|
$href = DOL_URL_ROOT . '/fourn/commande/fiche.php?id=' . $obj->rowid;
|
||||||
echo '<tr ' . $bc[$var] . '>',
|
echo '<tr ' . $bc[$var] . '>',
|
||||||
// Ref
|
// Ref
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user