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)
|
||||||
|
|
||||||
|
|||||||
@ -6265,10 +6265,10 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
* Return vat rate of a product in a particular country, or default country vat if product is unknown.
|
* Return vat rate of a product in a particular country, or default country vat if product is unknown.
|
||||||
* Function called by get_default_tva().
|
* Function called by get_default_tva().
|
||||||
*
|
*
|
||||||
* @param int $idprod Id of product or 0 if not a predefined product
|
* @param int $idprod Id of product or 0 if not a predefined product
|
||||||
* @param Societe $thirdpartytouse Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
* @param Societe $thirdpartytouse Thirdparty with a ->country_code defined (FR, US, IT, ...)
|
||||||
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" proposal/order/invoice)
|
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" proposal/order/invoice)
|
||||||
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)'
|
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)'
|
||||||
* @see get_product_localtax_for_country()
|
* @see get_product_localtax_for_country()
|
||||||
*/
|
*/
|
||||||
function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournprice = 0)
|
function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournprice = 0)
|
||||||
@ -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