From a96b92a618e96d605bf72ecb5972155e0773200d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 30 Sep 2015 14:06:45 +0200 Subject: [PATCH] FIX : Email selector contact must not include inactive contact --- htdocs/core/modules/mailings/contacts1.modules.php | 3 +++ htdocs/core/modules/mailings/contacts2.modules.php | 3 +++ htdocs/core/modules/mailings/contacts3.modules.php | 3 +++ htdocs/core/modules/mailings/contacts4.modules.php | 3 +++ 4 files changed, 12 insertions(+) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 3f8df87cd7a..f898442fae7 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -75,6 +75,7 @@ class mailing_contacts1 extends MailingTargets $statssql[0].= " WHERE c.entity IN (".getEntity('societe', 1).")"; $statssql[0].= " AND c.email != ''"; // Note that null != '' is false $statssql[0].= " AND c.no_email = 0"; + $statssql[0].= " AND c.statut = 1"; return $statssql; } @@ -98,6 +99,7 @@ class mailing_contacts1 extends MailingTargets $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.no_email = 0"; + $sql.= " AND c.statut = 1"; // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients @@ -204,6 +206,7 @@ class mailing_contacts1 extends MailingTargets $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email <> ''"; $sql.= " AND c.no_email = 0"; + $sql.= " AND c.statut = 1"; $sql.= " AND c.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; foreach($filtersarray as $key) { diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index fe49ce56b35..b0a82e5136e 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -86,6 +86,7 @@ class mailing_contacts2 extends MailingTargets $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email <> ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; //$sql.= " AND sp.poste != ''"; $sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'"; @@ -168,6 +169,7 @@ class mailing_contacts2 extends MailingTargets $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; //$sql.= " AND sp.poste != ''"; // La requete doit retourner un champ "nb" pour etre comprise // par parent::getNbOfRecipients @@ -191,6 +193,7 @@ class mailing_contacts2 extends MailingTargets $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; $sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')"; $sql.= " GROUP BY sp.poste"; $sql.= " ORDER BY sp.poste"; diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 92640291088..3333549e6da 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -85,6 +85,7 @@ class mailing_contacts3 extends MailingTargets if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE sp.email <> ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid"; @@ -173,6 +174,7 @@ class mailing_contacts3 extends MailingTargets $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.no_email = 0"; + $sql.= " AND c.statut = 1"; /* $sql = "SELECT count(distinct(sp.email)) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; @@ -208,6 +210,7 @@ class mailing_contacts3 extends MailingTargets $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND cs.fk_categorie = c.rowid"; $sql.= " AND cs.fk_societe = sp.fk_soc"; diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index 59355b372fe..747370bac07 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -85,6 +85,7 @@ class mailing_contacts4 extends MailingTargets $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc"; $sql.= " WHERE sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'"; $sql.= " ORDER BY sp.lastname, sp.firstname"; @@ -173,6 +174,7 @@ class mailing_contacts4 extends MailingTargets $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.no_email = 0"; + $sql.= " AND c.statut = 1"; /* $sql = "SELECT count(distinct(sp.email)) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; @@ -208,6 +210,7 @@ class mailing_contacts4 extends MailingTargets $sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; $sql.= " WHERE sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.no_email = 0"; + $sql.= " AND sp.statut = 1"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " GROUP BY c.label"; $sql.= " ORDER BY c.label";