From 6f9f2e17b920b170dc1784ef1bb36bef71873d3a Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Wed, 3 Apr 2019 11:15:13 -0500
Subject: [PATCH] issue: sendAccessLink On NULL

This addresses an issue where entering a collaborator's email to send ticket
email access link throws a fatal error. This is due to the method that
checks for tickets with the User's email equal to the email provided. This
only checks for User's emails not Collaborator emails. This adds a check for
Collaborator emails as well so this will not crash out.
---
 include/class.ticket.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index f269cb793..47b1713c5 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2884,7 +2884,10 @@ implements RestrictedAccess, Threadable {
             ->filter(array('number' => $number));
 
         if ($email)
-            $query->filter(array('user__emails__address' => $email));
+            $query->filter(Q::any(array(
+                'user__emails__address' => $email,
+                'thread__collaborators__user__emails__address' => $email
+            )));
 
 
         if (!$ticket) {
-- 
GitLab