From 07b676792a26886170eb657e23410686c0f2236a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 16 Jun 2017 01:02:53 +0200
Subject: [PATCH] Fix do not show localtax info if not used.

---
 htdocs/comm/card.php    | 12 +++++++-----
 htdocs/societe/card.php |  3 ++-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index b8906bd1038..a51ef902eb6 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -175,7 +175,7 @@ if (empty($reshook))
 		$result=$object->update($object->id, $user);
 		if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
 	}
-	
+
 	if ($action == 'update_extras') {
         $object->fetch($id);
 
@@ -262,21 +262,23 @@ if ($id > 0)
 		print '</tr>';
 	}
 
-	// Assujeti a TVA ou pas
+	// VAT is used
 	print '<tr>';
-	print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td>';
+	print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td>';
+	print '<td>';
 	print yn($object->tva_assuj);
 	print '</td>';
 	print '</tr>';
 
 	// Local Taxes
-	if ($mysoc->useLocalTax(1))
+	// TODO Move this on same record than VATIsUsed
+	if ($mysoc->localtax1_assuj=="1")
 	{
 		print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
 		print yn($object->localtax1_assuj);
 		print '</td></tr>';
 	}
-	if ($mysoc->useLocalTax(2))
+	if ($mysoc->localtax1_assuj=="1")
 	{
 		print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
 		print yn($object->localtax2_assuj);
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index b5afba996b8..46e6366bba1 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1766,8 +1766,9 @@ else
                     $formcompany->select_localtax(1,$object->localtax1_value, "lt1");
                     print '</span>';
                 }
+                print '</td>';
 
-                print '</td><td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
+                print '<td>'.fieldLabel($langs->transcountry("LocalTax2IsUsed",$mysoc->country_code),'localtax2assuj_value').'</td><td>';
                 print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1);
                 if  (! isOnlyOneLocalTax(2))
                 {
-- 
GitLab