Merge pull request #49 from csalvador/replenishment

Replenishment
This commit is contained in:
Raphaël Doursenaud 2013-07-30 02:06:12 -07:00
commit c6927404ef

View File

@ -1829,7 +1829,7 @@ class Form
* @param string $htmlname Name of HTML field * @param string $htmlname Name of HTML field
* @return void * @return void
*/ */
function select_product_fourn_price($productid,$htmlname='productfournpriceid', $showempty=0) function select_product_fourn_price($productid,$htmlname='productfournpriceid')
{ {
global $langs,$conf; global $langs,$conf;
@ -1862,7 +1862,7 @@ class Form
} }
else else
{ {
if($showempty && $num > 1) $form.= '<option value="0">&nbsp;</option>'; $form.= '<option value="0">&nbsp;</option>';
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
@ -1870,6 +1870,10 @@ class Form
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$opt = '<option value="'.$objp->idprodfournprice.'"'; $opt = '<option value="'.$objp->idprodfournprice.'"';
//if there is only one supplier, preselect it
if($num == 1) {
$opt .= ' selected="selected"';
}
$opt.= '>'.$objp->nom.' - '.$objp->ref_fourn.' - '; $opt.= '>'.$objp->nom.' - '.$objp->ref_fourn.' - ';
if ($objp->quantity == 1) if ($objp->quantity == 1)