CRM-17763 restore postEmailSend hook and create new postMailing hook
authorBrian Shaughnessy <brian@lcdservices.biz>
Fri, 1 Jan 2016 16:29:15 +0000 (11:29 -0500)
committerBrian Shaughnessy <brian@lcdservices.biz>
Fri, 1 Jan 2016 16:29:15 +0000 (11:29 -0500)
CRM/Mailing/BAO/MailingJob.php
CRM/Utils/Hook.php
CRM/Utils/Mail.php

index 6aa979738dca1affc5ecbc940bdcb08d5b7433be..4ec5fb4fbc70b61b51611de0b3c75ac10e71deb7 100644 (file)
@@ -288,7 +288,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
 
         // CRM-17763
         $details = CRM_Mailing_BAO_Mailing::report($job->mailing_id);
-        CRM_Utils_Hook::postEmailSend($details, 'civimail');
+        CRM_Utils_Hook::postMailing($details);
       }
     }
   }
index 9037c537bfb5720211ba554adcb59e2e2f59f4fd..8a95d958adcf0a1e6647d541e0787df9c2c0968a 100644 (file)
@@ -1557,19 +1557,34 @@ 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, $context = '') {
-    return self::singleton()->invoke(2, $params, $context,
-      self::$_nullObject, self::$_nullObject,
+  public static function postEmailSend(&$params) {
+    return self::singleton()->invoke(1, $params,
       self::$_nullObject, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
       'civicrm_postEmailSend'
     );
   }
 
+  /**
+   * This hook is called when a CiviMail mailing has completed
+   *
+   * @param array $report
+   *   Output from: CRM_Mailing_BAO_Mailing::report()
+   *   Includes details about the mailing, including stats to date, jobs, etc.
+   *
+   * @return mixed
+   */
+  public static function postMailing($report) {
+    return self::singleton()->invoke(1, $report,
+      self::$_nullObject, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_postMailing'
+    );
+  }
+
   /**
    * This hook is called when Settings specifications are loaded.
    *
index a1cdda0d53b02c02919f54ecbdfb65dafc07a020..c940eddaafe6756a9a99fd80bdc25e8f1ea9f69c 100644 (file)
@@ -281,7 +281,7 @@ class CRM_Utils_Mail {
         return FALSE;
       }
       // CRM-10699
-      CRM_Utils_Hook::postEmailSend($params, 'activity');
+      CRM_Utils_Hook::postEmailSend($params);
       return TRUE;
     }
     return FALSE;