Clean code to avoid confusion

This commit is contained in:
Laurent Destailleur 2018-03-15 14:25:09 +01:00
parent 7c62f22408
commit 620ceb54e3
4 changed files with 129 additions and 115 deletions

View File

@ -278,16 +278,25 @@ if ($object->id > 0)
print '</tr>'; print '</tr>';
} }
// This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier.
// We don't need them into customer profile.
// Except for spain and localtax where localtax depends on buyer and not seller
// VAT is used // VAT is used
/*
print '<tr>'; print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td>'; print '<td class="nowrap">';
print $form->textwithpicto($langs->trans('VATIsUsed'),$langs->trans('VATIsUsedWhenSelling'));
print '</td>';
print '<td>'; print '<td>';
print yn($object->tva_assuj); print yn($object->tva_assuj);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/
if ($mysoc->country_code == 'ES')
{
// Local Taxes // Local Taxes
// TODO Move this on same record than VATIsUsed
if ($mysoc->localtax1_assuj=="1") if ($mysoc->localtax1_assuj=="1")
{ {
print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>'; print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
@ -300,7 +309,7 @@ if ($object->id > 0)
print yn($object->localtax2_assuj); print yn($object->localtax2_assuj);
print '</td></tr>'; print '</td></tr>';
} }
}
// TVA Intra // TVA Intra
print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';

View File

@ -194,7 +194,9 @@ if ($object->id > 0)
// Assujetti a TVA ou pas // Assujetti a TVA ou pas
print '<tr>'; print '<tr>';
print '<td class="titlefield">'.$langs->trans('VATIsUsed').'</td><td>'; print '<td class="titlefield">';
print $form->textwithpicto($langs->trans('VATIsUsed'),$langs->trans('VATIsUsedWhenSelling'));
print '</td><td>';
print yn($object->tva_assuj); print yn($object->tva_assuj);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -77,6 +77,7 @@ Web=Web
Poste= Position Poste= Position
DefaultLang=Language by default DefaultLang=Language by default
VATIsUsed=Sales tax is used VATIsUsed=Sales tax is used
VATIsUsedWhenSelling=This define if this thirdparty includes a sale tax or not when it makes an invoice to its own customers
VATIsNotUsed=Sales tax is not used VATIsNotUsed=Sales tax is not used
CopyAddressFromSoc=Fill address with third party address CopyAddressFromSoc=Fill address with third party address
ThirdpartyNotCustomerNotSupplierSoNoRef=Thirdparty neither customer nor supplier, no available refering objects ThirdpartyNotCustomerNotSupplierSoNoRef=Thirdparty neither customer nor supplier, no available refering objects

View File

@ -2177,16 +2177,25 @@ else
} }
//if ($j % 2 == 1) print '<td colspan="2"></td></tr>'; //if ($j % 2 == 1) print '<td colspan="2"></td></tr>';
// This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier.
// We don't need them into customer profile.
// Except for spain and localtax where localtax depends on buyer and not seller
if ($object->fournisseur)
{
// VAT is used // VAT is used
print '<tr><td>'; print '<tr><td>';
print $langs->trans('VATIsUsed'); print $form->textwithpicto($langs->trans('VATIsUsed'),$langs->trans('VATIsUsedWhenSelling'));
print '</td><td>'; print '</td><td>';
print yn($object->tva_assuj); print yn($object->tva_assuj);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
// Local Taxes // Local Taxes
//TODO: Place into a function to control showing by country or study better option if ($object->fournisseur || $mysoc->country_code=='ES')
{
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>';
@ -2274,14 +2283,7 @@ else
} }
} }
/*
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>';
} }
*/
// VAT Code // VAT Code
print '<tr>'; print '<tr>';