From fd1433bf9bb8d2f3d46772d1740b098f9f12bfae Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Thu, 29 Jun 2023 18:25:41 -0600 Subject: [PATCH] Add missing Mailing Events to API4: Delivered, Forward, Reply --- .../Event/BAO/MailingEventDelivered.php | 19 ++++++++++++--- CRM/Mailing/Event/BAO/MailingEventForward.php | 2 +- .../Civi/Api4/MailingEventDelivered.php | 23 +++++++++++++++++++ .../Civi/Api4/MailingEventForward.php | 23 +++++++++++++++++++ ext/civi_mail/Civi/Api4/MailingEventReply.php | 23 +++++++++++++++++++ 5 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 ext/civi_mail/Civi/Api4/MailingEventDelivered.php create mode 100644 ext/civi_mail/Civi/Api4/MailingEventForward.php create mode 100644 ext/civi_mail/Civi/Api4/MailingEventReply.php diff --git a/CRM/Mailing/Event/BAO/MailingEventDelivered.php b/CRM/Mailing/Event/BAO/MailingEventDelivered.php index 6d823e71e3..0d651c1fe7 100644 --- a/CRM/Mailing/Event/BAO/MailingEventDelivered.php +++ b/CRM/Mailing/Event/BAO/MailingEventDelivered.php @@ -17,15 +17,15 @@ class CRM_Mailing_Event_BAO_MailingEventDelivered extends CRM_Mailing_Event_DAO_MailingEventDelivered { /** - * Create a new delivery event. + * Record a new delivery event. * * @param array $params * Associative array of delivery event values. * * @return \CRM_Mailing_Event_BAO_MailingEventDelivered */ - public static function &create(&$params) { - $q = &CRM_Mailing_Event_BAO_MailingEventQueue::verify($params['job_id'], + public static function recordDelivery(&$params) { + $q = CRM_Mailing_Event_BAO_MailingEventQueue::verify($params['job_id'], $params['event_queue_id'], $params['hash'] ); @@ -54,6 +54,19 @@ class CRM_Mailing_Event_BAO_MailingEventDelivered extends CRM_Mailing_Event_DAO_ return $delivered; } + /** + * Create function was renamed `recordDelivery` because it's not a standard CRUD create function + * + * @param array $params + * @deprecated + * + * @return \CRM_Mailing_Event_BAO_MailingEventDelivered + */ + public static function create(&$params) { + CRM_Core_Error::deprecatedFunctionWarning('recordDelivery'); + return self::recordDelivery($params); + } + /** * Get row count for the event selector. * diff --git a/CRM/Mailing/Event/BAO/MailingEventForward.php b/CRM/Mailing/Event/BAO/MailingEventForward.php index a94fcab29a..b626eccafb 100644 --- a/CRM/Mailing/Event/BAO/MailingEventForward.php +++ b/CRM/Mailing/Event/BAO/MailingEventForward.php @@ -183,7 +183,7 @@ class CRM_Mailing_Event_BAO_MailingEventForward extends CRM_Mailing_Event_DAO_Ma $successfulForward = TRUE; // Register the delivery event. - CRM_Mailing_Event_BAO_MailingEventDelivered::create($params); + CRM_Mailing_Event_BAO_MailingEventDelivered::recordDelivery($params); } $transaction->commit(); diff --git a/ext/civi_mail/Civi/Api4/MailingEventDelivered.php b/ext/civi_mail/Civi/Api4/MailingEventDelivered.php new file mode 100644 index 0000000000..08d38df771 --- /dev/null +++ b/ext/civi_mail/Civi/Api4/MailingEventDelivered.php @@ -0,0 +1,23 @@ +