From: Andrew Cormick-Dockery Date: Wed, 3 Feb 2016 05:04:48 +0000 (+0000) Subject: CRM-17959 - allow URL to be redirected if the queue ID is invalid but the URL ID... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9506b36dc7ceec2640f2e62e469f559e412c9b4a;p=civicrm-core.git CRM-17959 - allow URL to be redirected if the queue ID is invalid but the URL ID is OK --- diff --git a/CRM/Mailing/Event/BAO/TrackableURLOpen.php b/CRM/Mailing/Event/BAO/TrackableURLOpen.php index 8eecbd668d..1ef77a9c6a 100755 --- a/CRM/Mailing/Event/BAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/BAO/TrackableURLOpen.php @@ -79,9 +79,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();