Commit 4ea375b4 authored by eileen's avatar eileen

CRM-21749 fix obscure regression :Mailing api no longer respecting '_skip_evil_bao_auto_schedule_'

parent f4743a13
......@@ -1630,7 +1630,7 @@ ORDER BY civicrm_email.is_bulkmail DESC
// Create parent job if not yet created.
// Condition on the existence of a scheduled date.
if (!empty($params['scheduled_date']) && $params['scheduled_date'] != 'null') {
if (!empty($params['scheduled_date']) && $params['scheduled_date'] != 'null' && empty($params['_skip_evil_bao_auto_schedule_'])) {
$job = new CRM_Mailing_BAO_MailingJob();
$job->mailing_id = $mailing->id;
// If we are creating a new Completed mailing (e.g. import from another system) set the job to completed.
......
......@@ -85,6 +85,18 @@ class api_v3_MailingTest extends CiviUnitTestCase {
$this->getAndCheck($this->_params, $result['id'], 'mailing');
}
/**
* Tes that the parameter _skip_evil_bao_auto_schedule_ is respected & prevents jobs being created.
*/
public function testSkipAutoSchedule() {
$this->callAPISuccess('Mailing', 'create', array_merge($this->_params, [
'_skip_evil_bao_auto_schedule_' => TRUE,
'scheduled_date' => 'now'
]));
$this->callAPISuccessGetCount('Mailing', [], 1);
$this->callAPISuccessGetCount('MailingJob', [], 0);
}
/**
* Create a completed mailing (e.g when importing from a provider).
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment