Merge pull request #24965 from aspangaro/18a9
NEW VAT rate - Add entity
This commit is contained in:
commit
577642eac5
12 changed files with 45 additions and 13 deletions
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
|
||||
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
|
||||
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -208,7 +208,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
|
|||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
|
||||
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
|
||||
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||
$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid";
|
||||
$tabsql[10] = "SELECT t.rowid, t.entity, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity = ".getEntity($tabname[10]);
|
||||
$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]);
|
||||
$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]);
|
||||
|
|
@ -396,7 +396,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position";
|
|||
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code";
|
||||
$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
|
||||
$tabfieldinsert[9] = "code_iso,label,unicode";
|
||||
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity";
|
||||
$tabfieldinsert[11] = "element,source,code,libelle,position";
|
||||
$tabfieldinsert[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[13] = "code,libelle,type,entity";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -262,6 +263,7 @@ if (empty($mysoc->country_code)) {
|
|||
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$sql .= " ORDER BY t.taux ASC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
|
|
@ -6326,6 +6326,7 @@ class Form
|
|||
$sql .= " FROM " . $this->db->prefix() . "c_tva as t, " . $this->db->prefix() . "c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid";
|
||||
$sql .= " AND t.active > 0";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
|
||||
$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
|
|
|
|||
|
|
@ -6235,6 +6235,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer = "", $thirdparty_sell
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdparty_seller->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
if (!empty($vatratecode)) {
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'"; // If we have the code, we use it in priority
|
||||
} else {
|
||||
|
|
@ -6291,9 +6292,9 @@ function get_localtax_by_third($local)
|
|||
|
||||
$sql = " SELECT t.localtax".$local." as localtax";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.taux = (";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.active = 1 AND t.entity IN (".getEntity('c_tva').") AND t.taux = (";
|
||||
$sql .= "SELECT MAX(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = tt.fk_pays";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND tt.active = 1)";
|
||||
$sql .= " WHERE c.code = '".$db->escape($mysoc->country_code)."' AND t.entity IN (".getEntity('c_tva').") AND tt.active = 1)";
|
||||
$sql .= " AND t.localtax".$local."_type <> '0'";
|
||||
$sql .= " ORDER BY t.rowid DESC";
|
||||
|
||||
|
|
@ -6348,6 +6349,7 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid
|
|||
else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";*/
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
if ($vatratecode) {
|
||||
$sql .= " AND t.code = '".$db->escape($vatratecode)."'";
|
||||
}
|
||||
|
|
@ -6504,6 +6506,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
|
|||
$sql = "SELECT t.taux as vat_rate, t.code as default_vat_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active = 1 AND t.fk_pays = c.rowid AND c.code = '".$db->escape($thirdpartytouse->country_code)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$sql .= " ORDER BY t.use_default DESC, t.taux DESC, t.code ASC, t.recuperableonly ASC";
|
||||
$sql .= $db->plimit(1);
|
||||
|
||||
|
|
@ -6583,6 +6586,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdpartytouse)
|
|||
$sql = "SELECT taux as vat_rate, localtax1, localtax2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($thirdpartytouse->country_code)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$sql .= " ORDER BY t.taux DESC, t.recuperableonly ASC";
|
||||
$sql .= $db->plimit(1);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
|
||||
$sql .= " WHERE cv.taux = ".((float) $txtva);
|
||||
$sql .= " AND cv.fk_pays = ".((int) $countryid);
|
||||
$sql .= " AND cv.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
--
|
||||
-- Be carefull to requests order.
|
||||
-- This file must be loaded by calling /install/index.php page
|
||||
|
|
@ -33,7 +32,19 @@
|
|||
-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
|
||||
|
||||
|
||||
-- V19
|
||||
-- v18
|
||||
|
||||
|
||||
|
||||
|
||||
-- v19
|
||||
|
||||
-- VAT multientity
|
||||
-- VMYSQL4.1 DROP INDEX uk_c_tva_id on llx_c_tva;
|
||||
-- VPGSQL8.2 DROP INDEX uk_c_tva_id;
|
||||
ALTER TABLE llx_c_tva ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
|
||||
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (entity, fk_pays, code, taux, recuperableonly);
|
||||
|
||||
ALTER TABLE llx_ticket ADD COLUMN fk_contract integer DEFAULT 0 after fk_project;
|
||||
|
||||
UPDATE llx_product_lot SET manufacturing_date = datec WHERE manufacturing_date IS NULL;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
-- ========================================================================
|
||||
-- Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -16,6 +17,6 @@
|
|||
--
|
||||
-- ========================================================================
|
||||
|
||||
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, taux, recuperableonly);
|
||||
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (entity, fk_pays, code, taux, recuperableonly);
|
||||
|
||||
-- ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, recuperableonly); -- Not yet possible for compatibility reason, where old code is ''
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- ========================================================================
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2011-2012 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
-- Copyright (C) 2011-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
create table llx_c_tva
|
||||
(
|
||||
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
fk_pays integer NOT NULL,
|
||||
code varchar(10) DEFAULT '', -- a key to describe vat entry, for example FR20
|
||||
taux double NOT NULL,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2011-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2011-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
|
|
@ -539,6 +539,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code = '".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2014-2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014-2019 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -146,6 +146,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code = '".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -164,6 +165,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code = ''";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -318,6 +320,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -397,6 +400,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -650,6 +654,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -769,6 +774,7 @@ if (empty($reshook)) {
|
|||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -4556,6 +4556,7 @@ class Societe extends CommonObject
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$this->db->escape($this->country_code)."'";
|
||||
$sql .= " AND t.active = 1";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
if (empty($localTaxNum)) {
|
||||
$sql .= " AND (t.localtax1_type <> '0' OR t.localtax2_type <> '0')";
|
||||
} elseif ($localTaxNum == 1) {
|
||||
|
|
@ -4583,6 +4584,7 @@ class Societe extends CommonObject
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$this->db->escape($this->country_code)."'";
|
||||
$sql .= " AND t.active = 1 AND t.recuperableonly = 1";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
|
||||
dol_syslog("useNPR", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -118,7 +119,8 @@ if (empty($reshook)) {
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($mysoc->country_code)."'";
|
||||
$sql .= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1";
|
||||
$sql .= " AND t.code ='".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.code = '".$db->escape($vatratecode)."'";
|
||||
$sql .= " AND t.entity IN (".getEntity('c_tva').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
|
|||
Loading…
Reference in a new issue