diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 550ddfb3ae1..e60eceb17d1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6357,12 +6357,16 @@ class Form } } $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)) { + // Label with all localtax and code. For example: x.y / a.b / c.d (CODE)' $return .= $rate['labelpositiverates']; } else { + // Simple label $return .= vatrate($rate['label']); } + //$return.=($rate['code']?' '.$rate['code']:''); $return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the * (old behaviour only if new vat code is not used) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 960560d840c..e5810304e6a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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. * Function called by get_default_tva(). * - * @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 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)' + * @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 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)' * @see get_product_localtax_for_country() */ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournprice = 0) @@ -6329,7 +6329,16 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric } } else { // 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; } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6addeb70859..f6aa14865ec 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2518,6 +2518,7 @@ if ($action == 'create') { print ''; $defaultvat = -1; 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'; } print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1);