+ if (!empty($composeParams[$prefix . 'saveTemplate'])) {
+ $templateParams = array('is_active' => TRUE);
+ if ($prefix == 'SMS') {
+ $templateParams += array(
+ 'msg_text' => $params['sms_body_text'],
+ 'is_sms' => TRUE,
+ );
+ }
+ else {
+ $templateParams += array(
+ 'msg_text' => $params['body_text'],
+ 'msg_html' => $params['body_html'],
+ 'msg_subject' => $params['subject'],
+ );
+ }
+ $templateParams['msg_title'] = $composeParams[$prefix . 'saveTemplateName'];
+
+ $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
+ }