From: eileen Date: Thu, 11 Jan 2024 01:13:40 +0000 (+1300) Subject: Remove possibly-unavailable job_id from unsub function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1d0171746159187f5bd38d2be55d764ffdbdc7b9;p=civicrm-core.git Remove possibly-unavailable job_id from unsub function --- diff --git a/CRM/Mailing/Event/BAO/MailingEventQueue.php b/CRM/Mailing/Event/BAO/MailingEventQueue.php index d3f27f5aad..6662a9a165 100644 --- a/CRM/Mailing/Event/BAO/MailingEventQueue.php +++ b/CRM/Mailing/Event/BAO/MailingEventQueue.php @@ -71,8 +71,7 @@ class CRM_Mailing_Event_BAO_MailingEventQueue extends CRM_Mailing_Event_DAO_Mail /** * Verify that a queue event exists with the specified id/job id/hash. * - * @param int|int $job_id - * The job ID of the event to find. + * @param null $unused * @param int $queue_id * The Queue Event ID to find. * @param string $hash @@ -81,7 +80,7 @@ class CRM_Mailing_Event_BAO_MailingEventQueue extends CRM_Mailing_Event_DAO_Mail * @return object|null * The queue event if verified, or null */ - public static function verify($job_id, $queue_id, $hash) { + public static function verify($unused, $queue_id, $hash) { $success = NULL; $q = new CRM_Mailing_Event_BAO_MailingEventQueue(); if ($queue_id && $hash) { diff --git a/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php b/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php index d25a0caea0..1167d3d686 100644 --- a/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php +++ b/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php @@ -93,8 +93,7 @@ WHERE email = %2 /** * Unsubscribe a contact from all groups that received this mailing. * - * @param int $job_id - * The job ID. + * @param null $unused * @param int $queue_id * The Queue Event ID of the recipient. * @param string $hash @@ -107,7 +106,7 @@ WHERE email = %2 * * @throws \CRM_Core_Exception */ - public static function unsub_from_mailing($job_id, $queue_id, $hash, $return = FALSE): ?array { + public static function unsub_from_mailing($unused, $queue_id, $hash, $return = FALSE): ?array { // First make sure there's a matching queue event. $q = CRM_Mailing_Event_BAO_MailingEventQueue::verify(NULL, $queue_id, $hash); @@ -117,7 +116,7 @@ WHERE email = %2 $contact_id = $q->contact_id; - $mailing_id = (int) civicrm_api3('MailingJob', 'getvalue', ['id' => $job_id, 'return' => 'mailing_id']); + $mailing_id = (int) civicrm_api3('MailingJobQueue', 'getvalue', ['id' => $queue_id, 'return' => 'mailing_id']); $mailing_type = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailing_id, 'mailing_type', 'id'); // We need a mailing id that points to the mailing that defined the recipients.