Fix case of MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS is 'none'
This commit is contained in:
parent
61bea8630e
commit
24d7a72b06
@ -6357,12 +6357,16 @@ class Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return .= '>';
|
$return .= '>';
|
||||||
//if (!empty($conf->global->MAIN_VAT_SHOW_POSITIVE_RATES))
|
|
||||||
|
// Show label of VAT
|
||||||
if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) {
|
if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) {
|
||||||
|
// Label with all localtax and code. For example: x.y / a.b / c.d (CODE)'
|
||||||
$return .= $rate['labelpositiverates'];
|
$return .= $rate['labelpositiverates'];
|
||||||
} else {
|
} else {
|
||||||
|
// Simple label
|
||||||
$return .= vatrate($rate['label']);
|
$return .= vatrate($rate['label']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$return.=($rate['code']?' '.$rate['code']:'');
|
//$return.=($rate['code']?' '.$rate['code']:'');
|
||||||
$return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the * (old behaviour only if new vat code is not used)
|
$return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the * (old behaviour only if new vat code is not used)
|
||||||
|
|
||||||
|
|||||||
@ -6329,7 +6329,16 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Forced value if autodetect fails. MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS can be '1.23' or '1.23 (CODE)'
|
// Forced value if autodetect fails. MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS can be '1.23' or '1.23 (CODE)'
|
||||||
$ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS;
|
$defaulttx = '';
|
||||||
|
if ($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS != 'none') {
|
||||||
|
$defaulttx = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS;
|
||||||
|
}
|
||||||
|
/*if (preg_match('/\((.*)\)/', $defaulttx, $reg)) {
|
||||||
|
$defaultcode = $reg[1];
|
||||||
|
$defaulttx = preg_replace('/\s*\(.*\)/', '', $defaulttx);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$ret = $defaulttx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2518,6 +2518,7 @@ if ($action == 'create') {
|
|||||||
print '<td class="right inputvat">';
|
print '<td class="right inputvat">';
|
||||||
$defaultvat = -1;
|
$defaultvat = -1;
|
||||||
if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) {
|
if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) {
|
||||||
|
// If option to have no default VAT on expense report is on, we force MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS
|
||||||
$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
|
||||||
}
|
}
|
||||||
print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1);
|
print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user