Skip to content
Snippets Groups Projects
Unverified Commit 9eee7218 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #16239 from MegaphoneJon/mailing-60-522

mailing#60: Fix regression where `is_bulkmail` flag isn't respected
parents a80b5584 50efb875
Branches
Tags
No related merge requests found
......@@ -64,7 +64,7 @@ WHERE mailing_id = %1
// if any email is marked on_hold =1 or contact is deceased after mailing is submitted
// then it should be get skipped while preparing event_queue
// event_queue list is prepared when mailing job gets started.
$additionalJoin = " INNER JOIN civicrm_email e ON (r.email_id = e.id AND e.on_hold = 0 AND e.is_primary = 1)
$additionalJoin = " INNER JOIN civicrm_email e ON (r.email_id = e.id AND e.on_hold = 0)
INNER JOIN civicrm_contact c on (c.id = r.contact_id AND c.is_deceased <> 1 AND c.do_not_email = 0 AND c.is_opt_out = 0)
";
}
......
......@@ -127,6 +127,38 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase {
}
/**
* Test that "multiple bulk email recipients" setting is respected.
*/
public function testMultipleBulkRecipients() {
Civi::settings()->add([
'civimail_multiple_bulk_emails' => 1,
]);
$contactID = $this->individualCreate(['first_name' => 'test recipient']);
$email1 = $this->callAPISuccess('email', 'create', [
'contact_id' => $contactID,
'email' => 'mail1@example.org',
'is_bulkmail' => 1,
]);
$email2 = $this->callAPISuccess('email', 'create', [
'contact_id' => $contactID,
'email' => 'mail2@example.org',
'is_bulkmail' => 1,
]);
$this->callAPISuccess('group_contact', 'create', [
'contact_id' => $contactID,
'group_id' => $this->_groupID,
'status' => 'Added',
]);
$mailing = $this->callAPISuccess('mailing', 'create', $this->_params);
$this->assertEquals(2, $this->callAPISuccess('MailingRecipients', 'get', ['mailing_id' => $mailing['id']])['count']);
$this->callAPISuccess('job', 'process_mailing', []);
$this->_mut->assertRecipients([['mail1@example.org'], ['mail2@example.org']]);
// Don't leave data lying around for other tests to screw up on.
$this->callAPISuccess('Email', 'delete', ['id' => $email1['id']]);
$this->callAPISuccess('Email', 'delete', ['id' => $email2['id']]);
}
/**
* Test pause and resume on Mailing.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment