CRM-16722 - Fixed token fails in event registration email
authorchanzone <chanzone@gmail.com>
Fri, 26 Feb 2016 14:05:26 +0000 (22:05 +0800)
committerchanzone <chanzone@gmail.com>
Fri, 26 Feb 2016 14:05:26 +0000 (22:05 +0800)
CRM/Core/BAO/MessageTemplate.php

index ee6b7a9c99627a733d6d9145f633d2b228a05012..3f6e7a7114df6ade48eb2d3cdb042b4cb5696073 100644 (file)
@@ -405,6 +405,7 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
     $domain = CRM_Core_BAO_Domain::getDomain();
     $hookTokens = array();
     $mailing = new CRM_Mailing_BAO_Mailing();
+    $mailing->subject = $subject;
     $mailing->body_text = $text;
     $mailing->body_html = $html;
     $tokens = $mailing->getTokens();
@@ -417,6 +418,12 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
       $contactParams = array('contact_id' => $contactID);
       $returnProperties = array();
 
+      if (isset($tokens['subject']['contact'])) {
+        foreach ($tokens['subject']['contact'] as $name) {
+          $returnProperties[$name] = 1;
+        }
+      }
+
       if (isset($tokens['text']['contact'])) {
         foreach ($tokens['text']['contact'] as $name) {
           $returnProperties[$name] = 1;