forked from Wavyzz/dolibarr
Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/contact/list.php htdocs/core/modules/mailings/modules_mailings.php
This commit is contained in:
@@ -79,8 +79,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$statssql[0] .= " count(distinct(c.email)) as nb";
|
||||
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")";
|
||||
$statssql[0] .= " AND c.email != ''"; // Note that null != '' is false
|
||||
$statssql[0] .= " AND c.no_email = 0";
|
||||
$statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
|
||||
$statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
|
||||
$statssql[0] .= " AND c.statut = 1";
|
||||
|
||||
return $statssql;
|
||||
@@ -103,8 +103,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND c.email != ''"; // Note that null != '' is false
|
||||
$sql .= " AND c.no_email = 0";
|
||||
$sql .= " AND c.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
|
||||
// exclude unsubscribed users
|
||||
$sql .= " AND c.statut = 1";
|
||||
@@ -132,10 +131,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
/*$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 .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$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";
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -169,10 +167,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_socpeople = sp.rowid";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@@ -244,10 +241,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_soc = sp.fk_soc";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@@ -282,10 +278,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_soc = sp.fk_soc";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@@ -391,7 +386,6 @@ class mailing_contacts1 extends MailingTargets
|
||||
}
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''";
|
||||
$sql .= " AND sp.no_email = 0";
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
|
||||
// Exclude unsubscribed email adresses
|
||||
$sql .= " AND sp.statut = 1";
|
||||
|
||||
@@ -224,7 +224,7 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing =" .((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
|
||||
$sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
|
||||
|
||||
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
Reference in New Issue
Block a user