2
0
forked from Wavyzz/dolibarr

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
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'));
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$idprod = 0;
@@ -1183,13 +1183,13 @@ if (empty($reshook)) {
$vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $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
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$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_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
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$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_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'));
$pu_ht = GETPOST('price_ht');
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
$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
$info_bits = 0;

View File

@@ -421,8 +421,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free') {
$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_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'));
$pu_ht = GETPOST('price_ht');
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');
$pu_ht_devise = GETPOST('multicurrency_subprice');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Define info_bits
$info_bits = 0;

View File

@@ -1955,8 +1955,8 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$predef = '';
$product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
$price_ht = price2num(GETPOST('price_ht'));
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
$prod_entry_mode = GETPOST('prod_entry_mode', 'alpha');
if ($prod_entry_mode == 'free') {
$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_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'));
$pu_ht = GETPOST('price_ht');
$pu_ht = price2num(GETPOST('price_ht'), '', 2);
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');
$pu_ht_devise = GETPOST('multicurrency_subprice');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Define info_bits
$info_bits = 0;

View File

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

View File

@@ -2119,7 +2119,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
global $conf, $langs;
if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
$tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver'));
}
// Clean parameters

View File

@@ -379,17 +379,17 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$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);
} else {
$idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$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
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -711,7 +711,7 @@ if (empty($reshook)) {
if (GETPOST('price_ht') != '') {
$price_base_type = 'HT';
$ht = price2num(GETPOST('price_ht'));
$ht = price2num(GETPOST('price_ht'), '', 2);
} else {
$vatratecleaned = $vat_rate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) { // If vat is "xx (yy)"
@@ -719,12 +719,12 @@ if (empty($reshook)) {
$vatratecode = $reg[2];
}
$ttc = price2num(GETPOST('price_ttc'));
$ttc = price2num(GETPOST('price_ttc'), '', 2);
$ht = $ttc / (1 + ($vatratecleaned / 100));
$price_base_type = 'HT';
}
$pu_ht_devise = GETPOST('multicurrency_subprice');
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
// Extrafields Lines
$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;
$entrepot = $supplierorderdispatch->fk_entrepot;
$product = $supplierorderdispatch->fk_product;
$price = GETPOST('price');
$price = price2num(GETPOST('price'), '', 2);
$comment = $supplierorderdispatch->comment;
$eatby = $supplierorderdispatch->fk_product;
$sellby = $supplierorderdispatch->sellby;
$batch = $supplierorderdispatch->batch;
$supplierorderdispatch->qty = GETPOST('qty', 'int');
$supplierorderdispatch->qty = price2num(GETPOST('qty', 'alpha'), 'MS', 2);
$supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot');
$result = $supplierorderdispatch->update($user);
}

View File

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

View File

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

View File

@@ -529,17 +529,17 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$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);
} else {
$idprod = GETPOST('idprod', 'int');
$price_ht = price2num(GETPOST('price_ht'), 'MU');
$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
$tva_tx = '';
}
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$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
$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);
if (GETPOST('price_ht') != '') {
$ht = price2num(GETPOST('price_ht'));
$ht = price2num(GETPOST('price_ht'), '', 2);
}
if (GETPOST('price_ttc') != '') {
@@ -847,7 +847,7 @@ if (empty($reshook)) {
$vatratecode = $reg[2];
}
$ttc = price2num(GETPOST('price_ttc'));
$ttc = price2num(GETPOST('price_ttc'), '', 2);
$ht = $ttc / (1 + ($vatratecleaned / 100));
}