From 2062950bfb1d1f8aaed7775ce1059adbe03fdc05 Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Thu, 25 Oct 2018 12:14:03 -0500 Subject: [PATCH] issue: ticket_link Fatal Error This addresses an issue where replying to a ticket causes a Fatal Error for the system. This is due to the `$ticket` object not being set before the else statement therefore causing the `getId()` function to fail. This breaks down the if/else statement to make sure the `$ticket` object is in-fact set before continuing. --- include/class.client.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 11b500e4a..2d157ede5 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -59,19 +59,20 @@ implements EmailContact, ITicketUser, TemplateVariable { case 'ticket_link': $qstr = array(); if ($cfg && $cfg->isAuthTokenEnabled() - && ($ticket=$this->getTicket()) - && !$ticket->getThread()->getNumCollaborators()) { - $qstr['auth'] = $ticket->getAuthToken($this); - return sprintf('%s/view.php?%s', - $cfg->getBaseUrl(), - Http::build_query($qstr, false) - ); - } - else { - return sprintf('%s/tickets.php?id=%s', - $cfg->getBaseUrl(), - $ticket->getId() - ); + && ($ticket=$this->getTicket())) { + if (!$ticket->getThread()->getNumCollaborators()) { + $qstr['auth'] = $ticket->getAuthToken($this); + return sprintf('%s/view.php?%s', + $cfg->getBaseUrl(), + Http::build_query($qstr, false) + ); + } + else { + return sprintf('%s/tickets.php?id=%s', + $cfg->getBaseUrl(), + $ticket->getId() + ); + } } -- GitLab