Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/comm/propal/card.php
	htdocs/compta/facture/card.php
	htdocs/contrat/card.php
	htdocs/fichinter/card.php
	htdocs/fourn/commande/card.php
	htdocs/fourn/facture/card.php
	htdocs/supplier_proposal/card.php
This commit is contained in:
Laurent Destailleur
2021-03-03 11:37:34 +01:00
11 changed files with 41 additions and 43 deletions

View File

@@ -795,8 +795,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef = ''; $predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht')); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode'); $prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
@@ -1175,7 +1175,7 @@ if (empty($reshook)) {
$info_bits |= 0x01; $info_bits |= 0x01;
} }
// Clean parameters // Clean parameters
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml'));
// Define vat_rate // Define vat_rate
@@ -1183,13 +1183,13 @@ if (empty($reshook)) {
$vat_rate = str_replace('*', '', $vat_rate); $vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
$pu_ht = GETPOST('price_ht'); $pu_ht = price2num(GETPOST('price_ht'), '', 2);
// Add buying price // Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $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')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));

View File

@@ -616,8 +616,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef = ''; $predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode'); $prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
@@ -984,9 +984,9 @@ if (empty($reshook)) {
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $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')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml'));
$pu_ht = GETPOST('price_ht'); $pu_ht = price2num(GETPOST('price_ht'), '', 2);
$vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0); $vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0);
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;

View File

@@ -421,8 +421,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef = ''; $predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha'); $prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
@@ -719,10 +719,10 @@ if (empty($reshook)) {
//$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); //$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')); //$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml'));
$pu_ht = GETPOST('price_ht'); $pu_ht = price2num(GETPOST('price_ht'), '', 2);
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty'); $qty = GETPOST('qty');
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;

View File

@@ -1955,8 +1955,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef = ''; $predef = '';
$product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht')); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha'); $prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
@@ -2299,10 +2299,10 @@ if (empty($reshook)) {
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $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')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml')); $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'restricthtml') ? GETPOST('product_desc', 'restricthtml') : GETPOST('desc', 'restricthtml'));
$pu_ht = GETPOST('price_ht'); $pu_ht = price2num(GETPOST('price_ht'), '', 2);
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty'); $qty = GETPOST('qty');
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;

View File

@@ -367,8 +367,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product // Set if we used free entry or predefined product
$predef = ''; $predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht', 'CU')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
if (GETPOST('prod_entry_mode', 'alpha') == 'free') { if (GETPOST('prod_entry_mode', 'alpha') == 'free') {
$idprod = 0; $idprod = 0;
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
@@ -651,9 +651,8 @@ if (empty($reshook)) {
} }
// ajout prix d'achat // ajout prix d'achat
$fk_fournprice = $_POST['fournprice']; if (GETPOST('buying_price')) {
if (!empty($_POST['buying_price'])) { $pa_ht = price2num(GETPOST('buying_price'), '', 2);
$pa_ht = $_POST['buying_price'];
} else { } else {
$pa_ht = null; $pa_ht = null;
} }

View File

@@ -2119,7 +2119,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
global $conf, $langs; global $conf, $langs;
if ($tzoutput === 'auto') { if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); $tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver'));
} }
// Clean parameters // Clean parameters
@@ -5164,7 +5164,7 @@ function price2num($amount, $rounding = '', $option = 0)
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount);
} }
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123
$amount = str_replace($thousand, '', $amount); $amount = str_replace($thousand, '', $amount);
} }

View File

@@ -379,17 +379,17 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode'); $prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} else { } else {
$idprod = GETPOST('idprod', 'int'); $idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -711,7 +711,7 @@ if (empty($reshook)) {
if (GETPOST('price_ht') != '') { if (GETPOST('price_ht') != '') {
$price_base_type = 'HT'; $price_base_type = 'HT';
$ht = price2num(GETPOST('price_ht')); $ht = price2num(GETPOST('price_ht'), '', 2);
} else { } else {
$vatratecleaned = $vat_rate; $vatratecleaned = $vat_rate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)"
@@ -719,12 +719,12 @@ if (empty($reshook)) {
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
$ttc = price2num(GETPOST('price_ttc')); $ttc = price2num(GETPOST('price_ttc'), '', 2);
$ht = $ttc / (1 + ($vatratecleaned / 100)); $ht = $ttc / (1 + ($vatratecleaned / 100));
$price_base_type = 'HT'; $price_base_type = 'HT';
} }
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Extrafields Lines // Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);

View File

@@ -441,13 +441,13 @@ if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionne
$qty = $supplierorderdispatch->qty; $qty = $supplierorderdispatch->qty;
$entrepot = $supplierorderdispatch->fk_entrepot; $entrepot = $supplierorderdispatch->fk_entrepot;
$product = $supplierorderdispatch->fk_product; $product = $supplierorderdispatch->fk_product;
$price = GETPOST('price'); $price = price2num(GETPOST('price'), '', 2);
$comment = $supplierorderdispatch->comment; $comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->fk_product; $eatby = $supplierorderdispatch->fk_product;
$sellby = $supplierorderdispatch->sellby; $sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch; $batch = $supplierorderdispatch->batch;
$supplierorderdispatch->qty = GETPOST('qty', 'int'); $supplierorderdispatch->qty = price2num(GETPOST('qty', 'alpha'), 'MS', 2);
$supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot'); $supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot');
$result = $supplierorderdispatch->update($user); $result = $supplierorderdispatch->update($user);
} }

View File

@@ -1064,10 +1064,10 @@ if (empty($reshook)) {
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '') { if (GETPOST('price_ht') != '' || GETPOST('multicurrency_subprice') != '') {
$up = price2num(GETPOST('price_ht')); $up = price2num(GETPOST('price_ht'), '', 2);
$price_base_type = 'HT'; $price_base_type = 'HT';
} else { } else {
$up = price2num(GETPOST('price_ttc')); $up = price2num(GETPOST('price_ttc'), '', 2);
$price_base_type = 'TTC'; $price_base_type = 'TTC';
} }
@@ -1163,17 +1163,17 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode'); $prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} else { } else {
$idprod = GETPOST('idprod', 'int'); $idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);

View File

@@ -425,7 +425,6 @@ if ($object->id > 0) {
print '</tr>'; print '</tr>';
// Line to add a new line in inventory // Line to add a new line in inventory
//if ($action == 'addline') {
if ($object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_VALIDATED) {
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';

View File

@@ -529,17 +529,17 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode'); $prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') { if ($prod_entry_mode == 'free') {
$idprod = 0; $idprod = 0;
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
} else { } else {
$idprod = GETPOST('idprod', 'int'); $idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU'); $price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = ''; $tva_tx = '';
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -836,7 +836,7 @@ if (empty($reshook)) {
$localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty);
if (GETPOST('price_ht') != '') { if (GETPOST('price_ht') != '') {
$ht = price2num(GETPOST('price_ht')); $ht = price2num(GETPOST('price_ht'), '', 2);
} }
if (GETPOST('price_ttc') != '') { if (GETPOST('price_ttc') != '') {
@@ -847,7 +847,7 @@ if (empty($reshook)) {
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
$ttc = price2num(GETPOST('price_ttc')); $ttc = price2num(GETPOST('price_ttc'), '', 2);
$ht = $ttc / (1 + ($vatratecleaned / 100)); $ht = $ttc / (1 + ($vatratecleaned / 100));
} }