products now show up in the list even when they don't have a line in llx_product_stock

This commit is contained in:
Cédric Salvador 2013-06-10 11:57:06 +02:00
parent f7a7e953a3
commit bdb2a00539

View File

@ -90,6 +90,7 @@ if (! empty($_POST["button_removefilter_x"]))
//orders creation //orders creation
if($action == 'order'){ if($action == 'order'){
$linecount = GETPOST('linecount', 'int'); $linecount = GETPOST('linecount', 'int');
if($linecount > 0){
$suppliers = array(); $suppliers = array();
for($i = 0; $i < $linecount; $i++) { for($i = 0; $i < $linecount; $i++) {
if(GETPOST($i, 'alpha') === 'on') { //one line if(GETPOST($i, 'alpha') === 'on') { //one line
@ -117,8 +118,14 @@ if($action == 'order'){
$line->ref_fourn = $obj->ref_fourn; $line->ref_fourn = $obj->ref_fourn;
$suppliers[$obj->fk_soc]['lines'][] = $line; $suppliers[$obj->fk_soc]['lines'][] = $line;
} }
else {
$error=$db->lasterror();
dol_print_error($db);
dol_syslog("replenish.php: ".$error, LOG_ERROR);
} }
} }
}
$db->free($resql);
//we now know how many orders we need and what lines they have //we now know how many orders we need and what lines they have
$i = 0; $i = 0;
$orders = array(); $orders = array();
@ -137,6 +144,7 @@ if($action == 'order'){
} }
$i++; $i++;
} }
}
} }
/* /*
@ -202,7 +210,7 @@ $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.pr
$sql.= " p.fk_product_type, p.tms,"; $sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tobuy, p.seuil_stock_alerte"; $sql.= " p.duration, p.tobuy, p.seuil_stock_alerte";
$sql .= ", p.desiredstock"; $sql .= ", p.desiredstock";
$sql.= ' HAVING p.desiredstock > SUM(s.reel)'; $sql.= ' HAVING p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL';
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -357,6 +365,7 @@ if ($resql)
} }
print '<td align="right">'.$objp->desiredstock.'</td>'; print '<td align="right">'.$objp->desiredstock.'</td>';
print '<td align="right">'; print '<td align="right">';
if(!$objp->stock_physique) $objp->stock_physique = 0;
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
print $objp->stock_physique; print $objp->stock_physique;
print '</td>'; print '</td>';