From a3416cebabf9038faece5287586cfe0c090ec848 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Thu, 24 Mar 2011 00:13:19 +0000 Subject: [PATCH] Fix: Some contacts were lost. Number in colume "Total number" must be "total number" with no filter. Value after filtering is show inside the filter list. --- .../modules/mailings/contacts2.modules.php | 3 +++ .../modules/mailings/contacts3.modules.php | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/includes/modules/mailings/contacts2.modules.php b/htdocs/includes/modules/mailings/contacts2.modules.php index ed2117c233b..2d60eb7a1fa 100755 --- a/htdocs/includes/modules/mailings/contacts2.modules.php +++ b/htdocs/includes/modules/mailings/contacts2.modules.php @@ -148,6 +148,9 @@ class mailing_contacts2 extends MailingTargets { global $conf; + // We must report here number of contacts when absolutely no filter selected (so all contacts). + // Number with a filter are show in the combo list for each filter. + // If we want a filter "function is defined", we must add it into formFilter $sql = "SELECT count(distinct(sp.email)) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/includes/modules/mailings/contacts3.modules.php b/htdocs/includes/modules/mailings/contacts3.modules.php index 31d585aab03..4e507e2fabb 100755 --- a/htdocs/includes/modules/mailings/contacts3.modules.php +++ b/htdocs/includes/modules/mailings/contacts3.modules.php @@ -155,7 +155,18 @@ class mailing_contacts3 extends MailingTargets { global $conf; - $sql = "SELECT count(distinct(sp.email)) as nb"; + // We must report here number of contacts when absolutely no filter selected (so all contacts). + // Number with a filter are show in the combo list for each filter. + // If we want a filter "is inside at least one category", we must add it into formFilter + $sql = "SELECT count(distinct(c.email)) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.rowid = c.fk_soc"; + $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND c.email != ''"; // Note that null != '' is false + /* + $sql = "SELECT count(distinct(sp.email)) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."categorie as c,"; @@ -166,6 +177,7 @@ class mailing_contacts3 extends MailingTargets $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND cs.fk_categorie = c.rowid"; $sql.= " AND cs.fk_societe = sp.fk_soc"; + */ // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); -- GitLab