Fix: use $mysoc instead customer

This commit is contained in:
Regis Houssin 2012-08-30 22:14:18 +02:00
parent e84f57e62c
commit 9a6ddbe096
2 changed files with 13 additions and 6 deletions

View File

@ -3096,10 +3096,20 @@ class Form
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
}
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
// Disabled if $mysoc is not subject to VAT
$disabled=false; $title='';
if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
$title=' title="'.$langs->trans('VATIsNotUsed').'"';
$disabled=true;
}
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$title.'>';
foreach ($this->cache_vatrates as $rate)
{
// Force 0 if $mysoc is not subject to VAT
if ($disabled && $rate['txtva'] != 0) continue;
$return.= '<option value="'.$rate['txtva'];
$return.= $rate['nprtva'] ? '*': '';
$return.= '"';

View File

@ -145,11 +145,8 @@ if (! empty($conf->margin->enabled)) {
</td>
<td align="right">
<?php
if ($seller->tva_assuj == "0") echo '<input type="hidden" name="tva_tx" value="0">0';
else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer);
?>
<input type="hidden" id="origin_tva_tx_cache" name="origin_tva_tx_cache" value="" />
<?php echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer); ?>
<input type="hidden" id="origin_tva_tx_cache" name="origin_tva_tx_cache" value="" />
</td>
<td align="right">
<input type="text" size="8" id="price_ht" name="price_ht" value="<?php echo (GETPOST('price_ht')?GETPOST('price_ht'):''); ?>">