Simplify mailing check
authoreileen <emcnaughton@wikimedia.org>
Thu, 15 Apr 2021 23:53:30 +0000 (11:53 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 16 Apr 2021 19:00:05 +0000 (07:00 +1200)
This should do the same thing - note org is never defined so replaceOrgTokens does
nothing (& is not used anywhere else)

CRM/SMS/Form/Upload.php

index e9d2efb311431a58345f5f47dd8493e294e53ef5..c39cdb03fa725fb72d736c08bfc343a447cf6698 100644 (file)
@@ -338,14 +338,12 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
       $dummy_mail = new CRM_Mailing_BAO_Mailing();
       $mess = "body_text";
       $dummy_mail->$mess = $str;
+      $str = CRM_Core_BAO_MessageTemplate::renderMessageTemplate(['text' => $str, 'html' => '', 'subject' => ''], TRUE, CRM_Core_Session::getLoggedInContactID(), [])['text'];
       $tokens = $dummy_mail->getTokens();
 
       $str = CRM_Utils_Token::replaceSubscribeInviteTokens($str);
-      $str = CRM_Utils_Token::replaceDomainTokens($str, $domain, NULL, $tokens['text']);
       $str = CRM_Utils_Token::replaceMailingTokens($str, $mailing, NULL, $tokens['text']);
-      $str = CRM_Utils_Token::replaceOrgTokens($str, $org);
       $str = CRM_Utils_Token::replaceActionTokens($str, $verp, $urls, NULL, $tokens['text']);
-      $str = CRM_Utils_Token::replaceContactTokens($str, $contact, NULL, $tokens['text']);
 
       $unmatched = CRM_Utils_Token::unmatchedTokens($str);
       $contentCheck = CRM_Utils_String::htmlToText($str);