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

SMS Trait - add support for Autocomplete subscriber, notice fix #29429

Merged
merged 6 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Copy remaining functions in SMSCommon into the trait
I fixed 2 notices in the process by doing unconditional assigns & tested that the
formRule & postProcess are called. Other than the notices this is a straight move
  • Loading branch information
eileenmcnaughton committed Feb 18, 2024
commit 16b1692e4aebf478f39387ddabc08f1a2c2defae
2 changes: 1 addition & 1 deletion CRM/Activity/Form/Task/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function preProcess() {
* Build the form object.
*/
public function buildQuickForm() {
CRM_Contact_Form_Task_SMSCommon::buildQuickForm($this);
$this->buildSmsForm();
}

}
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function preProcess(): void {
public function buildQuickForm() {
//enable form element
$this->assign('suppressForm', FALSE);
CRM_Contact_Form_Task_SMSCommon::buildQuickForm($this);
$this->buildSmsForm();
}

}
12 changes: 9 additions & 3 deletions CRM/Contact/Form/Task/SMSCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

/**
* This class provides the common functionality for sending sms to one or a group of contact ids.
*
* @deprecated since 5.71 will be removed around 5.77.
*/
class CRM_Contact_Form_Task_SMSCommon {
const RECIEVED_SMS_ACTIVITY_SUBJECT = "SMS Received";
Expand Down Expand Up @@ -71,6 +73,8 @@ public static function preProcessProvider(&$form) {
* Build the form object.
*
* @param CRM_Core_Form $form
*
* @deprecated since 5.71 will be removed around 5.77.
*/
public static function buildQuickForm(&$form) {

Expand Down Expand Up @@ -105,7 +109,7 @@ public static function buildQuickForm(&$form) {

$form->_contactIds = [];
foreach ($allToPhone as $value) {
list($contactId, $phone) = explode('::', $value);
[$contactId, $phone] = explode('::', $value);
if ($contactId) {
$form->_contactIds[] = $contactId;
$form->_toContactPhone[] = $phone;
Expand Down Expand Up @@ -314,9 +318,11 @@ public static function formRule($fields, $dontCare, $self) {
* Process the form after the input has been submitted and validated.
*
* @param CRM_Core_Form $form
*
* @deprecated since 5.71 will be removed around 5.77.
*/
public static function postProcess(&$form) {

CRM_Core_Error::deprecatedFunctionWarning('no alternative supported for non-core use');
$thisValues = $form->controller->exportValues($form->getName());

$fromSmsProviderId = $thisValues['sms_provider_id'];
Expand Down Expand Up @@ -367,7 +373,7 @@ public static function postProcess(&$form) {
$contactIds = array_keys($form->_contactDetails);
$allContactIds = array_keys($form->_allContactDetails);

list($sent, $activityId, $countSuccess) = CRM_Activity_BAO_Activity::sendSMS($formattedContactDetails,
[$sent, $activityId, $countSuccess] = CRM_Activity_BAO_Activity::sendSMS($formattedContactDetails,
$thisValues,
$smsParams,
$contactIds
Expand Down
Loading