From: eileen Date: Thu, 11 Jan 2024 01:21:57 +0000 (+1300) Subject: Do not use job_id when looking up the mailin in unsubscribe table X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=03b999c4ffa1bfedc2568694f4e64a5ccbff6b8e;p=civicrm-core.git Do not use job_id when looking up the mailin in unsubscribe table --- diff --git a/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php b/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php index 1167d3d686..e831a5e172 100644 --- a/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php +++ b/CRM/Mailing/Event/BAO/MailingEventUnsubscribe.php @@ -116,7 +116,7 @@ WHERE email = %2 $contact_id = $q->contact_id; - $mailing_id = (int) civicrm_api3('MailingJobQueue', 'getvalue', ['id' => $queue_id, 'return' => 'mailing_id']); + $mailing_id = (int) civicrm_api3('MailingEventQueue', '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. @@ -334,8 +334,6 @@ WHERE email = %2 public static function send_unsub_response($queue_id, $groups, $is_domain, $job) { $config = CRM_Core_Config::singleton(); $domain = CRM_Core_BAO_Domain::getDomain(); - $jobObject = new CRM_Mailing_BAO_MailingJob(); - $jobTable = $jobObject->getTableName(); $mailingObject = new CRM_Mailing_DAO_Mailing(); $mailingTable = $mailingObject->getTableName(); $contactsObject = new CRM_Contact_DAO_Contact(); @@ -350,9 +348,9 @@ WHERE email = %2 $dao = new CRM_Mailing_BAO_Mailing(); $dao->query(" SELECT * FROM $mailingTable - INNER JOIN $jobTable ON - $jobTable.mailing_id = $mailingTable.id - WHERE $jobTable.id = $job"); + INNER JOIN civicrm_mailing_event_queue queue ON + queue.mailing_id = $mailingTable.id + WHERE queue.id = $queue_id"); $dao->fetch(); $component = new CRM_Mailing_BAO_MailingComponent();