Merge pull request #7399 from ptibogxiv/develop

FIX multicompany
This commit is contained in:
Laurent Destailleur 2017-09-15 18:55:29 +02:00 committed by GitHub
commit 9d9d5d6dc8
2 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
$DOLAPIENTITY = $_SERVER['HTTP_DOLAPIENTITY'];
$entity=(! empty($DOLAPIENTITY) ? (int) $DOLAPIENTITY : (! empty($DOLAPIENTITY) ? (int) $DOLAPIENTITY : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
$res=0;
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
if (! $res) die("Include of main fails");

View File

@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
$sql.= " d.amount, d.fk_statut as statut, ";
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
$sql.= " ON p.rowid = d.fk_projet WHERE 1 = 1";
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")";
if ($statut != '' && $statut != '-1')
{
$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";