From: Jon goldberg Date: Wed, 25 May 2016 21:17:28 +0000 (-0400) Subject: CRM-16888 - CiviSMS - fix templates not working with CiviSMS X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a7ea8fd5e8f74ea415d9ac026da4607e5a4da0fd;p=civicrm-core.git CRM-16888 - CiviSMS - fix templates not working with CiviSMS --- diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 63ac2807a7..17e9903869 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -327,8 +327,8 @@ class CRM_Contact_Form_Task_SMSCommon { } //Added for CRM-1393 - if (!empty($fields['saveTemplate']) && empty($fields['saveTemplateName'])) { - $errors['saveTemplateName'] = ts("Enter name to save message template"); + if (!empty($fields['SMSsaveTemplate']) && empty($fields['SMSsaveTemplateName'])) { + $errors['SMSsaveTemplateName'] = ts("Enter name to save message template"); } return empty($errors) ? TRUE : $errors; @@ -347,19 +347,20 @@ class CRM_Contact_Form_Task_SMSCommon { $fromSmsProviderId = $thisValues['sms_provider_id']; // process message template - if (!empty($thisValues['saveTemplate']) || !empty($thisValues['updateTemplate'])) { + if (!empty($thisValues['SMSsaveTemplate']) || !empty($thisValues['SMSupdateTemplate'])) { $messageTemplate = array( 'msg_text' => $thisValues['sms_text_message'], 'is_active' => TRUE, + 'is_sms' => TRUE, ); - if (!empty($thisValues['saveTemplate'])) { - $messageTemplate['msg_title'] = $thisValues['saveTemplateName']; + if (!empty($thisValues['SMSsaveTemplate'])) { + $messageTemplate['msg_title'] = $thisValues['SMSsaveTemplateName']; CRM_Core_BAO_MessageTemplate::add($messageTemplate); } - if (!empty($thisValues['template']) && !empty($thisValues['updateTemplate'])) { - $messageTemplate['id'] = $thisValues['template']; + if (!empty($thisValues['SMStemplate']) && !empty($thisValues['SMSupdateTemplate'])) { + $messageTemplate['id'] = $thisValues['SMStemplate']; unset($messageTemplate['msg_title']); CRM_Core_BAO_MessageTemplate::add($messageTemplate); } diff --git a/templates/CRM/Contact/Form/Task/SMS.tpl b/templates/CRM/Contact/Form/Task/SMS.tpl index 41f7e365a5..e458accabf 100644 --- a/templates/CRM/Contact/Form/Task/SMS.tpl +++ b/templates/CRM/Contact/Form/Task/SMS.tpl @@ -59,8 +59,8 @@ {if $SMSTask} - {$form.template.label} - {$form.template.html} + {$form.SMStemplate.label} + {$form.SMStemplate.html} {/if}