From b476efe55cf4578cc174e4cecaf1bbdd45928048 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 30 Aug 2022 08:30:13 +0200 Subject: [PATCH] Revert "Revert "Update thirdparties.modules.php"" This reverts commit 7dcf8969b9608a789f6ea4b02365e641e7b0dc14. --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 6f694cc0b74..008888832cd 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0"; + $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); }