diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 9f734c9e24d..5d8763c7bfe 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -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"); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 9602b69a615..1da2274e394 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -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).")";