From b8ac7a10cc730c7d8e42f0742fd60cd71cf78dc6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 5 Sep 2011 21:12:36 +0200 Subject: [PATCH 1/2] Fix: bad path --- htdocs/main.inc.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1f987b41859..689b9a48bce 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -750,14 +750,17 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { if (GETPOST('action') == 'switchentity' && $user->admin && ! $user->entity) { - require_once("../class/actions_multicompany.class.php"); - - $mc = new ActionsMulticompany($db); - - if($mc->switchEntity(GETPOST('entity')) > 0) + $res = @dol_include_once("/multicompany/class/actions_multicompany.class.php"); + + if ($res) { - Header("Location: ".DOL_URL_ROOT.'/'); - exit; + $mc = new ActionsMulticompany($db); + + if($mc->switchEntity(GETPOST('entity')) > 0) + { + Header("Location: ".DOL_URL_ROOT.'/'); + exit; + } } } } From 8eb2f17fcc5beea6dd76fdfa0ab84f1660281464 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 15 Sep 2011 09:39:05 +0200 Subject: [PATCH 2/2] Fix: bad value with multi-company module --- htdocs/lib/tax.lib.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/lib/tax.lib.php b/htdocs/lib/tax.lib.php index eebca0ca1d7..806f6793c55 100644 --- a/htdocs/lib/tax.lib.php +++ b/htdocs/lib/tax.lib.php @@ -76,9 +76,11 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction { $sql = "SELECT s.rowid as socid, s.nom as nom, s.tva_intra as tva_intra, s.tva_assuj as assuj,"; $sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva"; - $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f, ".MAIN_DB_PREFIX.$invoicedettable." as fd, ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE "; - $sql.= " f.fk_statut in (1,2)"; // Validated or paid (partially or completely) + $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,"; + $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as fd,"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE f.entity = " . $conf->entity; + $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql.= " AND (f.type = 0"; // Standard $sql.= " OR f.type = 1"; // Replacement $sql.= " OR f.type = 2)"; // Credit note @@ -234,8 +236,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,"; $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; - $sql.= " WHERE "; - $sql.= " f.fk_statut in (1,2)"; // Validated or paid (partially or completely) + $sql.= " WHERE f.entity = " . $conf->entity; + $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql.= " AND (f.type = 0"; // Standard $sql.= " OR f.type = 1"; // Replacement $sql.= " OR f.type = 2)"; // Credit note @@ -283,8 +285,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, // $sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,"; $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; - $sql.= " WHERE "; - $sql.= " f.fk_statut in (1,2)"; // Validated or paid (partially or completely) + $sql.= " WHERE f.entity = " . $conf->entity; + $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql.= " AND (f.type = 0"; // Standard $sql.= " OR f.type = 1"; // Replacement $sql.= " OR f.type = 2)"; // Credit note @@ -395,8 +397,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,"; $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; - $sql.= " WHERE "; - $sql.= " f.fk_statut in (1,2)"; // Validated or paid (partially or completely) + $sql.= " WHERE f.entity = " . $conf->entity; + $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) $sql.= " AND (f.type = 0"; // Standard $sql.= " OR f.type = 1"; // Replacement $sql.= " OR f.type = 2)"; // Credit note @@ -444,8 +446,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,"; $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; - $sql.= " WHERE "; - $sql.= " f.fk_statut in (1,2)"; // Paid (partially or completely) + $sql.= " WHERE f.entity = " . $conf->entity; + $sql.= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) $sql.= " AND (f.type = 0"; // Standard $sql.= " OR f.type = 1"; // Replacement $sql.= " OR f.type = 2)"; // Credit note