From 47ed731242e794df6a53a28afeb9e3af1f5d40f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Oct 2016 10:37:01 +0200 Subject: [PATCH 1/3] Fix group by --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 205f84c416f..b2b95d74963 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -530,7 +530,7 @@ if ($search_user > 0) } if (! $sall) { - $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; + $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid, s.code_client, s.client'; From 6a944bb6a3f82387b732cbfff6844c58986ff467 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 18 Oct 2016 10:11:42 +0200 Subject: [PATCH 2/3] Fix: Bad localtaxes calc for Spain if VAT is 0 --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fb577674b64..841edb130f3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7,7 +7,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2014 Cédric GROSS @@ -3170,7 +3170,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") { if ($local == 1) { - if(! $mysoc->localtax1_assuj) return 0; + if(! $mysoc->localtax1_assuj || $tva=="0") return 0; if ($thirdparty_seller->id==$mysoc->id) { if (! $thirdparty_buyer->localtax1_assuj) return 0; @@ -3183,7 +3183,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if ($local == 2) { - if(! $mysoc->localtax2_assuj) return 0; + if(! $mysoc->localtax2_assuj || $tva=="0") return 0; if ($thirdparty_seller->id==$mysoc->id ) { if (! $thirdparty_buyer->localtax2_assuj) return 0; From f28c7bbc6de857034ef03d40a9fa1eb36f120c29 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 18 Oct 2016 10:20:09 +0200 Subject: [PATCH 3/3] Fix: Bad localtaxes calc for Spain if VAT is 0. For >= 3.9.x --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b1e2610426c..46ff99b2898 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7,7 +7,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2014 Cédric GROSS @@ -3336,7 +3336,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller $vatratecleaned = $vatrate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" { - $vatratecleaned = $reg[1]; + $vatratecleaned = trim($reg[1]); $vatratecode = $reg[2]; } @@ -3350,7 +3350,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller { if ($local == 1) { - if (! $mysoc->localtax1_assuj) return 0; + if (! $mysoc->localtax1_assuj || $vatratecleaned=="0") return 0; if ($thirdparty_seller->id == $mysoc->id) { if (! $thirdparty_buyer->localtax1_assuj) return 0; @@ -3363,7 +3363,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 2) { - if (! $mysoc->localtax2_assuj) return 0; + if (! $mysoc->localtax2_assuj || $vatratecleaned=="0") return 0; if ($thirdparty_seller->id == $mysoc->id) { if (! $thirdparty_buyer->localtax2_assuj) return 0;