From 98dc5d9b98c4c3761e65ea4555a9eac0c1816c00 Mon Sep 17 00:00:00 2001 From: aydreeihn <adriane@enhancesoft.com> Date: Wed, 18 Jul 2018 16:57:23 -0500 Subject: [PATCH] Collaborator Tickets Visibility Fix: This commit fixes the counts in the Web Portal based on which Tickets the User has access to. --- include/class.client.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 1e82ebe41..83684cae3 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -321,6 +321,7 @@ class EndUser extends BaseAuthenticatedUser { } private function getStats() { + global $cfg; $basic = Ticket::objects() ->annotate(array('count' => SqlAggregate::COUNT('ticket_id'))) ->values('status__state', 'topic_id') @@ -338,10 +339,11 @@ class EndUser extends BaseAuthenticatedUser { // one index. Therefore, to scan two indexes (by user_id and // thread.collaborators.user_id), we need two queries. A union will // help out with that. - $mine->union($collab->filter(array( - 'thread__collaborators__user_id' => $this->getId(), - Q::not(array('user_id' => $this->getId())) - ))); + if ($cfg->collaboratorTicketsVisibility()) + $mine->union($collab->filter(array( + 'thread__collaborators__user_id' => $this->getId(), + Q::not(array('user_id' => $this->getId())) + ))); if ($orgid = $this->getOrgId()) { // Also generate a separate query for all the tickets owned by -- GitLab