diff --git a/include/class.client.php b/include/class.client.php index 1e82ebe411a214ecbc1e8f94dd33f2e5c120d836..83684cae3e51155a81f6c39a4ae95821429e399f 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