CRM-17763 trigger postEmailSend hook in civimail
authorBrian Shaughnessy <brian@lcdservices.biz>
Thu, 31 Dec 2015 19:33:42 +0000 (14:33 -0500)
committerBrian Shaughnessy <brian@lcdservices.biz>
Thu, 31 Dec 2015 19:33:42 +0000 (14:33 -0500)
CRM/Mailing/BAO/MailingJob.php
CRM/Utils/Hook.php
CRM/Utils/Mail.php

index 182265b34c2af108c06480e0259661f647bed07f..6aa979738dca1affc5ecbc940bdcb08d5b7433be 100644 (file)
@@ -285,6 +285,10 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
         $mailing->is_completed = TRUE;
         $mailing->save();
         $transaction->commit();
+
+        // CRM-17763
+        $details = CRM_Mailing_BAO_Mailing::report($job->mailing_id);
+        CRM_Utils_Hook::postEmailSend($details, 'civimail');
       }
     }
   }
index 5bcff27e6f5d1819c918bffd7356c1fc83d5a43d..9037c537bfb5720211ba554adcb59e2e2f59f4fd 100644 (file)
@@ -1557,13 +1557,15 @@ abstract class CRM_Utils_Hook {
    *   The mailing parameters. Array fields include: groupName, from, toName,
    *   toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers,
    *   attachments (array)
+   * @param string $context
+   *   Context of the mailing, either 'activity' or 'civimail'
    *
    * @return mixed
    */
-  public static function postEmailSend(&$params) {
-    return self::singleton()->invoke(1, $params,
+  public static function postEmailSend(&$params, $context = '') {
+    return self::singleton()->invoke(2, $params, $context,
+      self::$_nullObject, self::$_nullObject,
       self::$_nullObject, self::$_nullObject,
-      self::$_nullObject, self::$_nullObject, self::$_nullObject,
       'civicrm_postEmailSend'
     );
   }
index c940eddaafe6756a9a99fd80bdc25e8f1ea9f69c..a1cdda0d53b02c02919f54ecbdfb65dafc07a020 100644 (file)
@@ -281,7 +281,7 @@ class CRM_Utils_Mail {
         return FALSE;
       }
       // CRM-10699
-      CRM_Utils_Hook::postEmailSend($params);
+      CRM_Utils_Hook::postEmailSend($params, 'activity');
       return TRUE;
     }
     return FALSE;