From 780e8ce47005f4560e53ab963d1c099966eaa147 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 27 Nov 2017 15:13:14 +0100 Subject: [PATCH 1/2] fix for multicompany --- htdocs/core/modules/mailings/fraise.modules.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 05d9e525652fe..9fc82a2f95269 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -65,7 +65,7 @@ function __construct($db) */ function getSqlArrayForStats() { - global $langs; + global $conf, $langs; $langs->load("members"); @@ -73,7 +73,7 @@ function getSqlArrayForStats() $statssql=array(); $statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb"; - $statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1"; + $statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1 and entity = ".$conf->entity; return $statssql; } @@ -89,9 +89,11 @@ function getSqlArrayForStats() */ function getNbOfRecipients($sql='') { + global $conf; + $sql = "SELECT count(distinct(a.email)) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; - $sql .= " WHERE (a.email IS NOT NULL AND a.email != '')"; + $sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity = ".$conf->entity; // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients From a9e4fcfdca6fa094e0115e215a728d36196f3874 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 27 Nov 2017 15:49:28 +0100 Subject: [PATCH 2/2] Update fraise.modules.php --- htdocs/core/modules/mailings/fraise.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 9fc82a2f95269..f0b834c53ba99 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -73,7 +73,7 @@ function getSqlArrayForStats() $statssql=array(); $statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb"; - $statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1 and entity = ".$conf->entity; + $statssql[0].=" FROM ".MAIN_DB_PREFIX."adherent where statut = 1 and entity IN (".getEntity('member').")"; return $statssql; } @@ -93,7 +93,7 @@ function getNbOfRecipients($sql='') $sql = "SELECT count(distinct(a.email)) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; - $sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity = ".$conf->entity; + $sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")"; // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients