FIX vat value when code contains number

This commit is contained in:
Laurent Destailleur 2021-02-10 01:10:31 +01:00
parent afeeb40e2e
commit 408aefd46c
6 changed files with 15 additions and 7 deletions

View File

@ -1562,8 +1562,6 @@ class CommandeFournisseur extends CommonOrder
{
global $langs, $mysoc, $conf;
$error = 0;
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

View File

@ -564,7 +564,9 @@ if (empty($reshook))
$fk_unit = GETPOST('units', 'alpha');
$tva_tx = price2num($tva_tx); // When vat is text input field
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // When vat is text input field
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);

View File

@ -160,9 +160,13 @@ if (empty($reshook))
if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn;
$quantity = price2num(GETPOST("qty", 'nohtml'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent', 'alpha'));
$npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0;
$tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha'));
$tva_tx = price2num($tva_tx);
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx);
}
$price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode
$delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : '';
$supplier_reputation = GETPOST('supplier_reputation');

View File

@ -1923,7 +1923,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// Country
print '<tr><td>'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).'</td><td colspan="3">';
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx');
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';

View File

@ -720,7 +720,9 @@ if (empty($reshook))
$fk_unit = GETPOST('units', 'alpha');
$tva_tx = price2num($tva_tx); // When vat is text input field
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx); // When vat is text input field
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);

View File

@ -530,7 +530,9 @@ if ($action == "freezone") {
$tva_tx = GETPOST('tva_tx', 'alpha');
if ($tva_tx != '') {
$tva_tx = price2num($tva_tx);
if (!preg_match('/\((.*)\)/', $tva_tx)) {
$tva_tx = price2num($tva_tx);
}
} else {
$tva_tx = get_default_tva($mysoc, $customer);
}