Merge pull request #576 from simnandez/3.3

Fix: [ bug #662 ] Bad aplication of Localtax2 for suppliers if country is Spain
This commit is contained in:
Laurent Destailleur 2013-01-06 04:02:12 -08:00
commit d70f671ba0
2 changed files with 36 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Eric Seigne <erics@rycks.com> * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -153,6 +153,7 @@ if ($object->fetch($id))
print '</tr>'; print '</tr>';
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code=='ES') if($mysoc->country_code=='ES')
{ {
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
@ -176,6 +177,14 @@ if ($object->fetch($id))
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);
print '</td></tr>'; print '</td></tr>';
} }
if ($mysoc->localtax2_assuj!="1")
{
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print yn($object->localtax2_assuj);
print '</td><tr>';
}
} }
// TVA Intra // TVA Intra

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -932,6 +932,7 @@ else
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$object->capital.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$object->capital.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
@ -954,6 +955,12 @@ else
print '</td><tr>'; print '</td><tr>';
} }
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || GETPOST("type")=='') )
{
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax2assuj_value',0,1);
print '</td><tr>';
}
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3">'."\n"; print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3">'."\n";
@ -1349,6 +1356,7 @@ else
print '</tr>'; print '</tr>';
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
@ -1372,6 +1380,13 @@ else
print '</td></tr>'; print '</td></tr>';
} }
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1)
{
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print $form->selectyesno('localtax2assuj_value',0,1);
print '</td><tr>';
}
// Type - Size // Type - Size
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id); print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id);
@ -1665,6 +1680,7 @@ else
print '</tr>'; print '</tr>';
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
{ {
print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>'; print '<tr><td>'.$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code).'</td><td>';
@ -1687,6 +1703,13 @@ else
print '</td><tr>'; print '</td><tr>';
} }
if ($mysoc->country_code=='ES' && $mysoc->localtax2_assuj!="1" && ! empty($conf->fournisseur->enabled) && $object->fournisseur==1)
{
print '<tr><td>'.$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code).'</td><td colspan="3">';
print yn($object->localtax2_assuj);
print '</td><tr>';
}
// Type + Staff // Type + Staff
$arr = $formcompany->typent_array(1); $arr = $formcompany->typent_array(1);
$object->typent= $arr[$object->typent_code]; $object->typent= $arr[$object->typent_code];