From 61b28274f7fa7ab1c491095acbdfa4749798bf0a Mon Sep 17 00:00:00 2001 From: juanjo Date: Thu, 4 Apr 2013 16:32:06 +0200 Subject: [PATCH] [ bug #790 ] Spanish localtax RE not being correctly calculated --- htdocs/core/lib/functions.lib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index adb8f190ef6..71dbfbc1b2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2689,7 +2689,18 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe { - if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0; + if ($local == 1) + { + if ($thirdparty_seller->id==$mysoc->id) + { + if (! $thirdparty_buyer->localtax1_assuj) return 0; + } + else + { + if (! $thirdparty_seller->localtax1_assuj) return 0; + } + } + if ($local == 2 && ! $thirdparty_buyer->localtax2_assuj) return 0; } else