diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 95af5d1ff25..15646307c91 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3096,10 +3096,20 @@ class Form $defaulttx = $this->cache_vatrates[$num-1]['txtva']; } - if (! $options_only) $return.= ''; + // Disabled if customer is not subject to VAT + $disabled=false; + if (is_object($societe_acheteuse) && ! empty($societe_acheteuse->id) + && $societe_acheteuse->tva_assuj == "0") { + $disabled=true; + } + + if (! $options_only) $return.= ''; foreach ($this->cache_vatrates as $rate) { + // Force 0 if customer is not subject to VAT + if ($disabled && $rate['txtva'] != 0) continue; + $return.= 'margin->enabled)) { tva_assuj == "0") echo '0'; - else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer); + echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer); ?>