FIX unit price for selected supplier products not set. NaN was used.
This commit is contained in:
parent
1f5c8f682c
commit
2b8a06cb5e
@ -2907,7 +2907,7 @@ class Form
|
||||
$objp->fprice = $price_result;
|
||||
if ($objp->quantity >= 1)
|
||||
{
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity;
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity; // Replace dynamically unitprice
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2974,7 +2974,7 @@ class Form
|
||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt .= ' disabled';
|
||||
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0)
|
||||
{
|
||||
$opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
||||
$opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqup="'.$objp->unitprice.'" data-pbqpercent="'.$objp->remise_percent.'"';
|
||||
}
|
||||
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
|
||||
$opt .= '>';
|
||||
@ -2989,7 +2989,7 @@ class Form
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$out .= $opt;
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
|
||||
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
|
||||
// Exemple of var_dump $outarray
|
||||
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
|
||||
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
|
||||
|
||||
@ -261,7 +261,7 @@ if ($nolinesbefore) {
|
||||
if ($senderissupplier != 2)
|
||||
{
|
||||
$ajaxoptions = array(
|
||||
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
|
||||
'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
|
||||
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
|
||||
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user