-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev/core#352 Ensure that contacts that are to be exluded are not adde… #12712
Conversation
(Standard links)
|
CRM/Mailing/BAO/Mailing.php
Outdated
@@ -282,8 +282,10 @@ public static function getRecipients($mailingID) { | |||
// Get recipients selected in prior mailings | |||
if (!empty($priorMailingIDs['Include'])) { | |||
CRM_Utils_SQL_Select::from('civicrm_mailing_recipients') | |||
->select("contact_id, $entityColumn") | |||
->select("civicrm_mailing_recipients.contact_id, $entityColumn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add DISTINCT to select clause mostly on queries which involve temp table? because lately I encountered a issue that temp table are populated with duplicate entries and this causes performance issue in menu rebuild
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monishdeb sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see here the old code got DISTINCT in select clauses and this change has been lost during refactoring :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monishdeb added now
…d incorrectly when adding recipients of past mailings Add in DISTINCT clause as per Moonish's comment
3b34d0e
to
e3d924c
Compare
OK I took a look through this & per @seamuslee001 the exclude join is present in other places, just not this one. Merging. Yay test |
…d incorrectly when adding recipients of past mailings
Overview
When using recipients from a previous mailing as the recipients of a mailing. If any exclusion groups / mailings. The contacts in these are groups / mailings are not properly removed when adding the recipients of the mailing for inclusion.
Before
Contacts wrongly included in emails when previous mailing used as the inclusion
After
Contacts not wrongly included and unit test added
ping @eileenmcnaughton @monishdeb @totten @andrew-cormick-dockery @jtwyman