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-21316 Additional fix. Set default provider when creating SMS. #11628

Closed
Closed
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
11 changes: 10 additions & 1 deletion CRM/SMS/Form/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,22 @@ public function postProcess() {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');

// Add the best SMS provider as a default at this stage, so we can
// calculate recipients correctly.
$result = civicrm_api3('SmsProvider', 'get', array(
'is_active' => 1,
'options' => array('sort' => "is_default DESC, id ASC", 'limit' => 1),
));
$params['sms_provider_id'] = !empty($result['id']) ? $result['id'] : NULL;
}

// Create the mailing
$mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);

$this->set('mailing_id', $mailing->id);

// also compute the recipients and store them in the mailing recipients table
// Compute the recipients and store them in the mailing recipients table
CRM_Mailing_BAO_Mailing::getRecipients($mailing->id);

$count = CRM_Mailing_BAO_Recipients::mailingSize($mailing->id);
Expand Down