diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 1e60fb11377..1dc472ee888 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4137,11 +4137,18 @@ class Form
$return='';
- // Define defaultnpr and defaultttx
+ // Define defaultnpr, defaultttx and defaultcode
$defaultnpr=($info_bits & 0x01);
$defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr);
$defaulttx=str_replace('*','',$selectedrate);
-
+ $defaultcode='';
+ if (preg_match('/\s*\((.*)\)/', $defaulttx, $reg))
+ {
+ $defaultcode=$reg[1];
+ $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
+ }
+ //var_dump($defaulttx.'-'.$defaultnpr.'-'.$defaultcode);
+
// Check parameters
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
{
@@ -4237,9 +4244,13 @@ class Form
$return.= $rate['nprtva'] ? '*': '';
if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')';
$return.= '"';
- if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
+ if ($defaultcode)
{
- $return.= ' selected';
+ if ($defaultcode == $rate['code']) $return.= ' selected';
+ }
+ elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
+ {
+ $return.= ' selected';
}
$return.= '>'.vatrate($rate['libtva']);
//$return.=($rate['code']?' '.$rate['code']:'');