fix for multicompany

This commit is contained in:
ptibogxiv 2017-11-27 16:07:40 +01:00 committed by GitHub
parent 57d4f28cba
commit 0a5a50263d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,7 @@ class mailing_fraise extends MailingTargets
*/ */
function getSqlArrayForStats() function getSqlArrayForStats()
{ {
global $langs; global $conf,$langs;
$langs->load("members"); $langs->load("members");
@ -73,7 +73,7 @@ class mailing_fraise extends MailingTargets
$statssql=array(); $statssql=array();
$statssql[0] ="SELECT '".$this->db->escape($langs->trans("FundationMembers"))."' as label, count(*) as nb"; $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 IN (".getEntity('member').")";
return $statssql; return $statssql;
} }
@ -89,9 +89,10 @@ class mailing_fraise extends MailingTargets
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')
{ {
global $conf;
$sql = "SELECT count(distinct(a.email)) as nb"; $sql = "SELECT count(distinct(a.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $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 aentity IN (".getEntity('member').")";
// La requete doit retourner un champ "nb" pour etre comprise // La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients // par parent::getNbOfRecipients