From 79c34f4d691673633c151b1af11f4155fec1c531 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 14 Apr 2018 10:03:21 +0200 Subject: [PATCH 1/2] Fix: project category is type 6 not 5 !! --- htdocs/install/mysql/migration/5.0.0-6.0.0.sql | 2 +- htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 37f0ca415bd..58e58c63c5c 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -489,7 +489,7 @@ DELETE FROM llx_categorie_product WHERE fk_categorie NOT IN (SELECT rowid FROM l DELETE FROM llx_categorie_societe WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type IN (1, 2)); DELETE FROM llx_categorie_member WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 3); DELETE FROM llx_categorie_contact WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 4); -DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 5); +DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 6); ALTER TABLE llx_inventory ADD COLUMN ref varchar(48); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 68671ecd4d7..59f0ae58d97 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -168,7 +168,7 @@ delete from llx_categorie_fournisseur where fk_categorie not in (select rowid fr delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type = 2); delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3); delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4); -delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5); +delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 6); -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links. From bfed1b9db1e9f7202f650e5f8cae3a0ea0b315c9 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 14 Apr 2018 12:45:40 +0200 Subject: [PATCH 2/2] FIX: some localtaxes errors --- .gitignore | 0 htdocs/core/lib/functions.lib.php | 58 ++++++++----------------------- 2 files changed, 14 insertions(+), 44 deletions(-) mode change 100755 => 100644 .gitignore diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2c89bb6598b..6efd4595a33 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1,13 +1,13 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2018 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Cédric GROSS @@ -3768,10 +3768,14 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller } else // i am the seller { - if (!isOnlyOneLocalTax($local)) // This is for spain only, we don't return value found into datbase even if there is only one locatax vat. - { - return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; - } + if (in_array($mysoc->country_code, array('ES'))) + { + return $thirdparty_buyer->localtax2_value; + } + else + { + return $conf->global->MAIN_INFO_VALUE_LOCALTAX2; + } } } } @@ -3926,50 +3930,16 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi $obj = $db->fetch_object($resql); if ($local == 1) { - if (! isOnlyOneLocalTax(1)) - { - return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); - } - else - { - return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy); - } + return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); } elseif ($local == 2) { - if (! isOnlyOneLocalTax(2)) - { - return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy); - } - else - { - return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy); - } + return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy); } else { - if(! isOnlyOneLocalTax(1)) - { - if(! isOnlyOneLocalTax(2)) - { - return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); - } - else - { - return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy); - } - } - else - { - if(! isOnlyOneLocalTax(2)) - { - return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); - } - else - { - return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy); - } - } + return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); + } }