From b201a5cece365d9bcb2f1f79b7a989764c9c85af Mon Sep 17 00:00:00 2001 From: Andrew Cormick-Dockery Date: Wed, 3 Feb 2016 05:26:19 +0000 Subject: [PATCH] CRM-17959 - allow URL to be redirected if the queue ID is invalid but the URL ID is OK --- CRM/Mailing/Event/BAO/TrackableURLOpen.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CRM/Mailing/Event/BAO/TrackableURLOpen.php b/CRM/Mailing/Event/BAO/TrackableURLOpen.php index 3c17ae7c9e..02c364be86 100755 --- a/CRM/Mailing/Event/BAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/BAO/TrackableURLOpen.php @@ -81,9 +81,16 @@ class CRM_Mailing_Event_BAO_TrackableURLOpen extends CRM_Mailing_Event_DAO_Track ); if (!$search->fetch()) { - /* Whoops, error, don't track it. Return the base url. */ + /* Can't find either the URL or the queue. If we can find the URL then + return the URL without tracking. Otherwise return the base URL. */ - return CRM_Utils_System::baseURL(); + $search->query("SELECT $turl.url as url from $turl + WHERE $turl.id = " . CRM_Utils_Type::escape($url_id, 'Integer') + ); + if (!$search->fetch()) { + return CRM_Utils_System::baseURL(); + } + return $search->url; } $open = new CRM_Mailing_Event_BAO_TrackableURLOpen(); -- 2.25.1