From: Brian Shaughnessy Date: Thu, 31 Dec 2015 19:33:42 +0000 (-0500) Subject: CRM-17763 trigger postEmailSend hook in civimail X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b0fd9a5bef2ceb07c2bbcb8f2872d49cedcaa750;p=civicrm-core.git CRM-17763 trigger postEmailSend hook in civimail --- diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 182265b34c..6aa979738d 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -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'); } } } diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 5bcff27e6f..9037c537bf 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -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' ); } diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index c940eddaaf..a1cdda0d53 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -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;