diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 598c472f52a..25a29270976 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -899,6 +899,7 @@ if (empty($reshook)) { $price_ht_devise = ''; $price_ttc = ''; $price_ttc_devise = ''; + if (GETPOST('price_ht') !== '') { $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); } @@ -1319,7 +1320,7 @@ if (empty($reshook)) { $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); - //$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); + $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); @@ -1403,7 +1404,14 @@ if (empty($reshook)) { $qty = price2num(GETPOST('qty', 'alpha'), 'MS'); - $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); + $pu = $pu_ht; + $price_base_type = 'HT'; + if (empty($pu) && ! empty($pu_ttc)) { + $pu = $pu_ttc; + $price_base_type = 'TTC'; + } + + $result = $object->updateline(GETPOST('lineid', 'int'), $pu, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, $price_base_type, $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); if ($result >= 0) { $db->commit(); @@ -2717,7 +2725,7 @@ if ($action == 'create') { * Lines */ - // Show object lines + // Get object lines $result = $object->getLinesArray(); // Add products/services form @@ -2725,7 +2733,7 @@ if ($action == 'create') { global $inputalsopricewithtax; $inputalsopricewithtax = 1; - print '