NEW : filter by supplier on replenish.php

This commit is contained in:
gauthier
2016-10-05 15:06:30 +02:00
parent 0b49d6316e
commit 9c8ecdc8d8
2 changed files with 38 additions and 16 deletions

View File

@@ -2266,13 +2266,13 @@ class Form
* @param string $htmlname Name of HTML field
* @return void
*/
function select_product_fourn_price($productid,$htmlname='productfournpriceid')
function select_product_fourn_price($productid, $selected_supplier='', $htmlname='productfournpriceid')
{
global $langs,$conf;
$langs->load('stocks');
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
@@ -2309,7 +2309,7 @@ class Form
$opt = '<option value="'.$objp->idprodfournprice.'"';
//if there is only one supplier, preselect it
if($num == 1) {
if($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier)) {
$opt .= ' selected';
}
$opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';