CRM-21494 trigger pre hook on mailing bounce (#11353)
authormountev <33451769+mountev@users.noreply.github.com>
Wed, 6 Dec 2017 19:38:15 +0000 (19:38 +0000)
committerEileen McNaughton <eileen@mcnaughty.com>
Wed, 6 Dec 2017 19:38:15 +0000 (08:38 +1300)
* create mailing bounce hook

* CRM-21494 create-edit action and post-hook

* CRM-21494 - pre hook 3rd arg

CRM/Mailing/Event/BAO/Bounce.php

index ae9944f0b9eadb51aa63cf5a71063c71103d161c..ac5d8735e3f97a9de84e2825a6038b7852bc80c6 100644 (file)
@@ -61,6 +61,9 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce {
     $bounce = new CRM_Mailing_Event_BAO_Bounce();
     $bounce->time_stamp = date('YmdHis');
 
+    $action = empty($params['id']) ? 'create' : 'edit';
+    CRM_Utils_Hook::pre($action, 'MailingEventBounce', CRM_Utils_Array::value('id', $params), $params);
+
     // if we dont have a valid bounce type, we should set it
     // to bounce_type_id 11 which is Syntax error. this allows such email
     // addresses to be bounce a few more time before being put on hold
@@ -80,6 +83,8 @@ class CRM_Mailing_Event_BAO_Bounce extends CRM_Mailing_Event_DAO_Bounce {
     $bounce->copyValues($params);
     $bounce->save();
 
+    CRM_Utils_Hook::post($action, 'MailingEventBounce', $bounce->id, $bounce);
+
     if ($q->email_id) {
       self::putEmailOnHold($q->email_id);
     }