Skip to content
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

CRM-18543 Deleting email address or phone of CiviMail recipient hangs job #8355

Merged
merged 2 commits into from
Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CRM/Mailing/BAO/MailingJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ public function queue($testParams = NULL) {
$params = array();
$count = 0;
while ($recipients->fetch()) {
// CRM-18543: there are situations when both the email and phone are null.
// Skip the recipient in this case.
if (empty($recipients->email_id) && empty($recipients->phone_id)) {
continue;
}

if ($recipients->phone_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more concerned about these following lines, which set strings of 'null' D:

Copy link
Contributor Author

@kenwest kenwest May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem for me is not so much the 'null' strings (which are needed as part of the INSERT statement), but the disconnect between the calling code (which says that a mailing job is either 'sms' or 'email') and this code which allows individual recipients to be treated as either 'sms' or 'email'.

Eg, what if (for an SMS job) all but one recipient have a phone_id, and that one has an email? My thought is that there's no point creating a recipient that won't be used, or worse, is mistakenly used.

$recipients->email_id = "null";
}
Expand Down