2
0
forked from Wavyzz/dolibarr

FIX SUPPLIER PROPOSAL v12 bug add

This commit is contained in:
atm-benoit
2020-12-04 15:37:00 +01:00
parent ac30348081
commit b9461322d9

View File

@@ -554,8 +554,8 @@ if (empty($reshook))
} }
else else
{ {
$idprod = GETPOST('idprod', 'int'); $idprod = GETPOST('idprod', 'int');
$price_ht = ''; $price_ht = GETPOST('price_ht');
$tva_tx = ''; $tva_tx = '';
} }
@@ -589,8 +589,8 @@ if (empty($reshook))
$error++; $error++;
} }
if (!$error && ($qty >= 0)) { if (!$error && ($qty >= 0)) {
$pu_ht = 0; $pu_ht = price2num($price_ht, 'MU');
$pu_ttc = 0; $pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
$price_min = 0; $price_min = 0;
$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
@@ -658,41 +658,41 @@ if (empty($reshook))
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr);
$pu_ht = $productsupplier->fourn_pu;
if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value
// If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used) // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used)
$fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1); $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1);
$buyingprice = 0; $buyingprice = 0;
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$result = $object->addline( $result = $object->addline(
$desc, $desc,
$pu_ht, $pu_ht,
$qty, $qty,
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$productsupplier->id, $productsupplier->id,
$remise_percent, $remise_percent,
$price_base_type, $price_base_type,
$pu_ttc, $pu_ttc,
$tva_npr, $tva_npr,
$type, $type,
-1, -1,
0, 0,
GETPOST('fk_parent_line'), GETPOST('fk_parent_line'),
$fournprice, $fournprice,
$buyingprice, $buyingprice,
$label, $label,
$array_options, $array_options,
$ref_supplier, $ref_supplier,
$productsupplier->fk_unit, $productsupplier->fk_unit,
'', '',
0, 0,
$productsupplier->fourn_multicurrency_unitprice, $pu_ht_devise,
$date_start, $date_start,
$date_end $date_end
); );
//var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit;
if ($result < 0) if ($result < 0)