From: Tim Otten Date: Thu, 12 Sep 2013 05:20:20 +0000 (-0700) Subject: MessageTemplate - Change XML/BAO/DAO references from "MessageTemplates" to "MessageTe... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c6327d7d1cc549257b821bb8e658337fd875e880;p=civicrm-core.git MessageTemplate - Change XML/BAO/DAO references from "MessageTemplates" to "MessageTemplate" --- diff --git a/.gitignore b/.gitignore index a7d4cf6ec0..fa113526e0 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ CRM/Core/DAO/Managed.php CRM/Core/DAO/Mapping.php CRM/Core/DAO/MappingField.php CRM/Core/DAO/Menu.php +CRM/Core/DAO/MessageTemplate.php CRM/Core/DAO/MessageTemplates.php CRM/Core/DAO/Navigation.php CRM/Core/DAO/Note.php diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index ce352bd3aa..279f83d1fd 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -49,7 +49,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { ); $this->assign('action', $this->_action); - $this->_BAOName = 'CRM_Core_BAO_MessageTemplates'; + $this->_BAOName = 'CRM_Core_BAO_MessageTemplate'; $this->set('BAOName', $this->_BAOName); parent::preProcess(); } @@ -148,11 +148,11 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { CRM_Utils_System::appendBreadCrumb($breadCrumb); $this->applyFilter('__ALL__', 'trim'); - $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_title'), TRUE); + $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_title'), TRUE); $this->add('text', 'msg_subject', ts('Message Subject'), - CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplates', 'msg_subject') + CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_subject') ); //get the tokens. @@ -195,7 +195,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { // if not a system message use a wysiwyg editor, CRM-5971 if ($this->_id && - CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplates', + CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplate', $this->_id, 'workflow_id' ) @@ -235,7 +235,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { - CRM_Core_BAO_MessageTemplates::del($this->_id); + CRM_Core_BAO_MessageTemplate::del($this->_id); } elseif ($this->_action & CRM_Core_Action::VIEW) { // currently, the above action is used solely for previewing default workflow templates @@ -256,7 +256,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { $params['is_active'] = TRUE; } - $messageTemplate = CRM_Core_BAO_MessageTemplates::add($params); + $messageTemplate = CRM_Core_BAO_MessageTemplate::add($params); CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)), ts('Saved'), 'success'); if ($this->_workflow_id) { diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 08ee598666..40bce4d533 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -446,7 +446,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $templateParams['id'] = $values['template']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { @@ -459,7 +459,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $templateParams['msg_title'] = $composeParams['saveTemplateName']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (isset($msgTemplate->id)) { diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 38552fe4a3..0f0427c164 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -171,7 +171,7 @@ class CRM_Admin_Page_AJAX { $status = ts('Are you sure you want to disable this custom data group? Any profile fields that are linked to custom fields of this group will be disabled.'); break; - case 'CRM_Core_BAO_MessageTemplates': + case 'CRM_Core_BAO_MessageTemplate': $status = ts('Are you sure you want to disable this message tempate?'); break; diff --git a/CRM/Admin/Page/MessageTemplates.php b/CRM/Admin/Page/MessageTemplates.php index 4300815560..597d5d51a8 100644 --- a/CRM/Admin/Page/MessageTemplates.php +++ b/CRM/Admin/Page/MessageTemplates.php @@ -80,7 +80,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { * @return string Classname of BAO. */ function getBAOName() { - return 'CRM_Core_BAO_MessageTemplates'; + return 'CRM_Core_BAO_MessageTemplate'; } /** @@ -100,13 +100,13 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { ), CRM_Core_Action::DISABLE => array( 'name' => ts('Disable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_MessageTemplates' . '\',\'' . 'enable-disable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_MessageTemplate' . '\',\'' . 'enable-disable' . '\' );"', 'ref' => 'disable-action', 'title' => ts('Disable this message template'), ), CRM_Core_Action::ENABLE => array( 'name' => ts('Enable'), - 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_MessageTemplates' . '\',\'' . 'disable-enable' . '\' );"', + 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Core_BAO_MessageTemplate' . '\',\'' . 'disable-enable' . '\' );"', 'ref' => 'enable-action', 'title' => ts('Enable this message template'), ), @@ -175,7 +175,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { $this->_revertedId = $id; - CRM_Core_BAO_MessageTemplates::revert($id); + CRM_Core_BAO_MessageTemplate::revert($id); } $this->assign('selectedChild', CRM_Utils_Request::retrieve('selectedChild', 'String', $this)); @@ -238,7 +238,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { $action -= CRM_Core_Action::ENABLE; } - $messageTemplate = new CRM_Core_BAO_MessageTemplates(); + $messageTemplate = new CRM_Core_BAO_MessageTemplate(); $messageTemplate->orderBy('msg_title' . ' asc'); $userTemplates = array(); diff --git a/CRM/Campaign/BAO/Petition.php b/CRM/Campaign/BAO/Petition.php index e3876b72c5..abfcded7e3 100644 --- a/CRM/Campaign/BAO/Petition.php +++ b/CRM/Campaign/BAO/Petition.php @@ -582,7 +582,7 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; CRM_Contact_BAO_GroupContact::addContactsToGroup($p, $group_id, 'API'); if ($params['email-Primary']) { - CRM_Core_BAO_MessageTemplates::sendTemplate( + CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_petition', 'valueName' => 'petition_sign', @@ -639,7 +639,7 @@ AND tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )"; $tplParams['petition'] = $petitionTokens; if ($params['email-Primary']) { - CRM_Core_BAO_MessageTemplates::sendTemplate( + CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_petition', 'valueName' => 'petition_confirmation_needed', diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 09b2db08e4..d844b81c05 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1429,7 +1429,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type $displayName = CRM_Utils_Array::value('display_name', $info); - list($result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_case', 'valueName' => 'case_activity', diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index 507f4b1a15..3d8a4cf143 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -342,7 +342,7 @@ class CRM_Contact_Form_Task_EmailCommon { if (CRM_Utils_Array::value('saveTemplate', $formValues)) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } if (CRM_Utils_Array::value('template', $formValues) && @@ -350,7 +350,7 @@ class CRM_Contact_Form_Task_EmailCommon { ) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } } diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 078aa20c21..0bde670b72 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -48,7 +48,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { static function preProcess(&$form) { $messageText = array(); $messageSubject = array(); - $dao = new CRM_Core_BAO_MessageTemplates(); + $dao = new CRM_Core_BAO_MessageTemplate(); $dao->is_active = 1; $dao->find(); while ($dao->fetch()) { @@ -274,14 +274,14 @@ class CRM_Contact_Form_Task_PDFLetterCommon { } if (CRM_Utils_Array::value('saveTemplate', $formValues) && $formValues['saveTemplate']) { $messageTemplate['msg_title'] = $formValues['saveTemplateName']; - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } if (CRM_Utils_Array::value('updateTemplate', $formValues) && $formValues['template'] && $formValues['updateTemplate']) { $messageTemplate['id'] = $formValues['template']; unset($messageTemplate['msg_title']); - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } } elseif (CRM_Utils_Array::value('template', $formValues) > 0) { diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 2e86f8df85..3a115f6db9 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -360,7 +360,7 @@ class CRM_Contact_Form_Task_SMSCommon { if (CRM_Utils_Array::value('saveTemplate', $thisValues)) { $messageTemplate['msg_title'] = $thisValues['saveTemplateName']; - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } if (CRM_Utils_Array::value('template', $thisValues) && @@ -368,7 +368,7 @@ class CRM_Contact_Form_Task_SMSCommon { ) { $messageTemplate['id'] = $thisValues['template']; unset($messageTemplate['msg_title']); - CRM_Core_BAO_MessageTemplates::add($messageTemplate); + CRM_Core_BAO_MessageTemplate::add($messageTemplate); } } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index f707edbf26..83cbb9a178 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -364,7 +364,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ); if ($returnMessageText) { - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); return array( 'subject' => $subject, 'body' => $message, @@ -379,7 +379,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $sendTemplateParams['toEmail'] = $email; $sendTemplateParams['cc'] = CRM_Utils_Array::value('cc_receipt', $values); $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc_receipt', $values); - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } // send duplicate alert, if dupe match found during on-behalf-of processing. @@ -395,7 +395,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // fix cc and reset back to original, CRM-6976 $sendTemplateParams['cc'] = $originalCCReceipt; - CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } } } @@ -414,7 +414,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio 'PDFFilename' => 'receipt.pdf', ); if ($returnMessageText) { - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); return array( 'subject' => $subject, 'body' => $message, @@ -507,7 +507,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio $template->assign('updateSubscriptionUrl', $url); } - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($templatesParams); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($templatesParams); if ($sent) { CRM_Core_Error::debug_log_message('Success: mail sent for recurring notification.'); diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index fb57efd6ae..69d72c8172 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -496,7 +496,7 @@ class CRM_Contribute_Form_AdditionalInfo { $form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date'])); } - list($sendReceipt, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($sendReceipt, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_contribution', 'valueName' => 'contribution_offline_receipt', diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 9d95223618..886e35af9f 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -305,7 +305,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { 'toName' => $this->_donorDisplayName, 'toEmail' => $this->_donorEmail, ); - list($sent) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } } else { diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index 56479a32a5..e45388cd6d 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -400,7 +400,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { 'toName' => $donorDisplayName, 'toEmail' => $donorEmail, ); - list($sent) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } else { $status = ts('There was some problem updating the billing details.'); diff --git a/CRM/Contribute/Form/UpdateSubscription.php b/CRM/Contribute/Form/UpdateSubscription.php index 542897d0cd..c7b7fca12c 100644 --- a/CRM/Contribute/Form/UpdateSubscription.php +++ b/CRM/Contribute/Form/UpdateSubscription.php @@ -304,7 +304,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form { 'toName' => $donorDisplayName, 'toEmail' => $donorEmail, ); - list($sent) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } } diff --git a/CRM/Core/BAO/MessageTemplates.php b/CRM/Core/BAO/MessageTemplates.php index ff1995880d..0eacbd9f38 100644 --- a/CRM/Core/BAO/MessageTemplates.php +++ b/CRM/Core/BAO/MessageTemplates.php @@ -34,7 +34,7 @@ */ require_once 'Mail/mime.php'; -class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { +class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate { /** * Takes a bunch of params that are needed to match certain criteria and @@ -46,12 +46,12 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the flattened values * - * @return object CRM_Core_BAO_MessageTemplates object + * @return object CRM_Core_BAO_MessageTemplate object * @access public * @static */ static function retrieve(&$params, &$defaults) { - $messageTemplates = new CRM_Core_DAO_MessageTemplates(); + $messageTemplates = new CRM_Core_DAO_MessageTemplate(); $messageTemplates->copyValues($params); if ($messageTemplates->find(TRUE)) { CRM_Core_DAO::storeValues($messageTemplates, $defaults); @@ -70,7 +70,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { * @static */ static function setIsActive($id, $is_active) { - return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_MessageTemplates', $id, 'is_active', $is_active); + return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_MessageTemplate', $id, 'is_active', $is_active); } /** @@ -87,7 +87,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { $hook = empty($params['id']) ? 'create' : 'edit'; CRM_Utils_Hook::pre($hook, 'MessageTemplate', CRM_Utils_Array::value('id', $params), $params); - $messageTemplates = new CRM_Core_DAO_MessageTemplates(); + $messageTemplates = new CRM_Core_DAO_MessageTemplate(); $messageTemplates->copyValues($params); $messageTemplates->save(); @@ -117,7 +117,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { $params = array(1 => array($messageTemplatesID, 'Integer')); CRM_Core_DAO::executeQuery($query, $params); - $messageTemplates = new CRM_Core_DAO_MessageTemplates(); + $messageTemplates = new CRM_Core_DAO_MessageTemplate(); $messageTemplates->id = $messageTemplatesID; $messageTemplates->delete(); CRM_Core_Session::setStatus(ts('Selected message template has been deleted.'), ts('Deleted'), 'success'); @@ -134,7 +134,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { static function getMessageTemplates($all = TRUE) { $msgTpls = array(); - $messageTemplates = new CRM_Core_DAO_MessageTemplates(); + $messageTemplates = new CRM_Core_DAO_MessageTemplate(); $messageTemplates->is_active = 1; if (!$all) { @@ -150,7 +150,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { static function sendReminder($contactId, $email, $messageTemplateID, $from) { - $messageTemplates = new CRM_Core_DAO_MessageTemplates(); + $messageTemplates = new CRM_Core_DAO_MessageTemplate(); $messageTemplates->id = $messageTemplateID; $domain = CRM_Core_BAO_Domain::getDomain(); @@ -193,7 +193,7 @@ class CRM_Core_BAO_MessageTemplates extends CRM_Core_DAO_MessageTemplates { $returnProperties, null, null, false, $tokens, - 'CRM_Core_BAO_MessageTemplates'); + 'CRM_Core_BAO_MessageTemplate'); $contact = reset( $details ); // call token hook diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 149b02f630..19931b5329 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -2662,7 +2662,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) foreach ($emailList as $emailTo) { // FIXME: take the below out of the foreach loop - CRM_Core_BAO_MessageTemplates::sendTemplate( + CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_uf', 'valueName' => 'uf_notify', diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 90c85c8382..5614be76af 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1124,7 +1124,7 @@ WHERE civicrm_event.is_active = 1 } if ($returnMessageText) { - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); return array( 'subject' => $subject, 'body' => $message, @@ -1143,7 +1143,7 @@ WHERE civicrm_event.is_active = 1 $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc_confirm', $values['event'] ); - CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } } } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 8f26d1fe15..2f26fe66aa 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1458,7 +1458,7 @@ UPDATE civicrm_participant $receiptFrom = $eventDetails['confirm_from_name'] . ' <' . $eventDetails['confirm_from_email'] . '>'; } - list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_event', 'valueName' => 'participant_' . strtolower($mailType), diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index fe4c26e99c..6ec2c741df 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -351,7 +351,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $this->set($template_param_to_copy, $send_template_params['tplParams'][$template_param_to_copy]); } - CRM_Core_BAO_MessageTemplates::sendTemplate($send_template_params); + CRM_Core_BAO_MessageTemplate::sendTemplate($send_template_params); } static function formRule($fields, $files, $self) { diff --git a/CRM/Event/Form/ManageEvent/ScheduleReminders.php b/CRM/Event/Form/ManageEvent/ScheduleReminders.php index 3cfb45fe3b..53b7491958 100755 --- a/CRM/Event/Form/ManageEvent/ScheduleReminders.php +++ b/CRM/Event/Form/ManageEvent/ScheduleReminders.php @@ -358,7 +358,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage $templateParams['id'] = $values['template']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { @@ -371,7 +371,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage $templateParams['msg_title'] = $composeParams['saveTemplateName']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (isset($msgTemplate->id)) { diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 2a06eab876..6b2eb3813b 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1705,7 +1705,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} ); $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails); } - list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate($sendTemplateParams); + list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); if ($mailSent) { $sent[] = $contactID; foreach ($participants as $ids => $values) { diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index f44900ef06..b2d74b66a4 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -301,7 +301,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { foreach ($values['email'] as $displayName => $emailTo) { if ($emailTo) { // FIXME: factor the below out of the foreach loop - CRM_Core_BAO_MessageTemplates::sendTemplate( + CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_friend', 'valueName' => 'friend', diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index 28cb7e20dc..4ac926c2ef 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -2415,7 +2415,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id ); - $form->_templates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE); + $form->_templates = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE); if (!empty($form->_templates)) { $form->assign('templates', TRUE); $form->add('select', 'template', ts('Use Template'), @@ -2492,7 +2492,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id ) ); - $form->_templates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE); + $form->_templates = CRM_Core_BAO_MessageTemplate::getMessageTemplates(FALSE); if (!empty($form->_templates)) { $form->assign('templates', TRUE); $form->add('select', 'template', ts('Select Template'), diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php index dd1bafe9d0..a0a084d493 100644 --- a/CRM/Mailing/Form/Upload.php +++ b/CRM/Mailing/Form/Upload.php @@ -96,7 +96,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $this->assign('templateSelected', $templateId ? $templateId : 0); if (isset($defaults['msg_template_id']) && !$templateId) { $defaults['template'] = $defaults['msg_template_id']; - $messageTemplate = new CRM_Core_DAO_MessageTemplates(); + $messageTemplate = new CRM_Core_DAO_MessageTemplate(); $messageTemplate->id = $defaults['msg_template_id']; $messageTemplate->selectAdd(); $messageTemplate->selectAdd('msg_text, msg_html'); @@ -396,7 +396,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $templateParams['id'] = $formValues['template']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { @@ -409,7 +409,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { $templateParams['msg_title'] = $composeParams['saveTemplateName']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (isset($msgTemplate->id)) { @@ -660,7 +660,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form { } } - $templateName = CRM_Core_BAO_MessageTemplates::getMessageTemplates(); + $templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates(); if (CRM_Utils_Array::value('saveTemplate', $params) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) ) { diff --git a/CRM/Mailing/Page/AJAX.php b/CRM/Mailing/Page/AJAX.php index 270fd4d7f7..f97b441032 100644 --- a/CRM/Mailing/Page/AJAX.php +++ b/CRM/Mailing/Page/AJAX.php @@ -44,7 +44,7 @@ class CRM_Mailing_Page_AJAX { public static function template() { $templateId = CRM_Utils_Type::escape($_POST['tid'], 'Integer'); - $messageTemplate = new CRM_Core_DAO_MessageTemplates(); + $messageTemplate = new CRM_Core_DAO_MessageTemplate(); $messageTemplate->id = $templateId; $messageTemplate->selectAdd(); $messageTemplate->selectAdd('msg_text, msg_html, msg_subject, pdf_format_id'); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 811a7e6357..e70c88fd45 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1833,7 +1833,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } } - list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_membership', 'valueName' => 'membership_offline_receipt', diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 0bbeee780b..7ff44a5be7 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -880,7 +880,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } } - list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($mailSend, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_membership', 'valueName' => 'membership_offline_receipt', diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index 18f61f93c7..b9a58cc7c5 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -670,7 +670,7 @@ WHERE pcp.id = %1 AND cc.contribution_status_id =1 AND cc.is_test = 0"; $tplName = $isInitial ? 'pcp_supporter_notify' : 'pcp_status_change'; - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_contribution', 'valueName' => $tplName, diff --git a/CRM/PCP/Form/Campaign.php b/CRM/PCP/Form/Campaign.php index a307483997..7802dc343e 100644 --- a/CRM/PCP/Form/Campaign.php +++ b/CRM/PCP/Form/Campaign.php @@ -320,7 +320,7 @@ class CRM_PCP_Form_Campaign extends CRM_Core_Form { unset($emailArray[0]); $cc = implode(',', $emailArray); - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_contribution', 'valueName' => 'pcp_notify', diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 686a7e5eda..32f97e3b50 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -636,7 +636,7 @@ GROUP BY currency $receiptFrom = "$userName <$userEmail>"; } - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_pledge', 'valueName' => 'pledge_acknowledge', @@ -999,7 +999,7 @@ SELECT pledge.contact_id as contact_id, $template->assign('amount', $details['amount']); $template->assign('create_date', $details['create_date']); $template->assign('currency', $details['currency']); - list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_pledge', 'valueName' => 'pledge_reminder', diff --git a/CRM/SMS/Form/Upload.php b/CRM/SMS/Form/Upload.php index d9c3d0b416..6c415defb0 100644 --- a/CRM/SMS/Form/Upload.php +++ b/CRM/SMS/Form/Upload.php @@ -85,7 +85,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { $this->assign('templateSelected', $templateId ? $templateId : 0); if (isset($defaults['msg_template_id']) && !$templateId) { $defaults['template'] = $defaults['msg_template_id']; - $messageTemplate = new CRM_Core_DAO_MessageTemplates(); + $messageTemplate = new CRM_Core_DAO_MessageTemplate(); $messageTemplate->id = $defaults['msg_template_id']; $messageTemplate->selectAdd(); $messageTemplate->selectAdd('msg_text'); @@ -252,7 +252,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { $templateParams['id'] = $formValues['template']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (CRM_Utils_Array::value('saveTemplate', $composeParams)) { @@ -263,7 +263,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { $templateParams['msg_title'] = $composeParams['saveTemplateName']; - $msgTemplate = CRM_Core_BAO_MessageTemplates::add($templateParams); + $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams); } if (isset($msgTemplate->id)) { @@ -412,7 +412,7 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form { } } - $templateName = CRM_Core_BAO_MessageTemplates::getMessageTemplates(); + $templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates(); if (CRM_Utils_Array::value('saveTemplate', $params) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName) ) { diff --git a/bin/deprecated/UpdatePledgeRecord.php b/bin/deprecated/UpdatePledgeRecord.php index 26af0e7909..c37ead66b5 100644 --- a/bin/deprecated/UpdatePledgeRecord.php +++ b/bin/deprecated/UpdatePledgeRecord.php @@ -241,8 +241,8 @@ SELECT pledge.contact_id as contact_id, $template->assign('amount', $details['amount']); $template->assign('create_date', $details['create_date']); - require_once 'CRM/Core/BAO/MessageTemplates.php'; - list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + require_once 'CRM/Core/BAO/MessageTemplate.php'; + list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( array( 'groupName' => 'msg_tpl_workflow_pledge', 'valueName' => 'pledge_reminder', diff --git a/tests/phpunit/api/v3/MessageTemplatesTest.php b/tests/phpunit/api/v3/MessageTemplatesTest.php index 7dc726e2a4..a038ddb5fc 100644 --- a/tests/phpunit/api/v3/MessageTemplatesTest.php +++ b/tests/phpunit/api/v3/MessageTemplatesTest.php @@ -44,7 +44,7 @@ class api_v3_MessageTemplatesTest extends CiviUnitTestCase { $this->_apiversion = 3; parent::setUp(); $this->quickCleanup(array('civicrm_msg_template')); - $template = CRM_Core_DAO::createTestObject('CRM_Core_DAO_MessageTemplates')->toArray(); + $template = CRM_Core_DAO::createTestObject('CRM_Core_DAO_MessageTemplate')->toArray(); $this->params = array( 'msg_title' => $template['msg_title'], 'msg_subject' => $template['msg_subject'], diff --git a/xml/schema/Core/MessageTemplates.xml b/xml/schema/Core/MessageTemplates.xml index 04cbcefe4a..91f115fd53 100644 --- a/xml/schema/Core/MessageTemplates.xml +++ b/xml/schema/Core/MessageTemplates.xml @@ -2,7 +2,7 @@ CRM/Core - MessageTemplates + MessageTemplatecivicrm_msg_templateUsers will need a way to save and retrieve templates with tokens for use in recurring email communication tasks1.6 diff --git a/xml/schema/Core/files.xml b/xml/schema/Core/files.xml index 5bb914eeac..b3c190f800 100644 --- a/xml/schema/Core/files.xml +++ b/xml/schema/Core/files.xml @@ -27,7 +27,7 @@ - +