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 diff --git a/include/class.config.php b/include/class.config.php index 8cd3012e74920e916c7a45d518d7fc903cd153cc..41ee9a88779583742ecb9e977143a068b09a6ab6 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -197,6 +197,7 @@ class OsticketConfig extends Config { 'agent_name_format' => 'full', # First Last 'client_name_format' => 'original', # As entered 'auto_claim_tickets'=> true, + 'collaborator_ticket_visibility' => true, 'system_language' => 'en_US', 'default_storage_bk' => 'D', 'message_autoresponder_collabs' => true, @@ -919,6 +920,10 @@ class OsticketConfig extends Config { return $this->get('auto_claim_tickets'); } + function collaboratorTicketsVisibility() { + return $this->get('collaborator_ticket_visibility'); + } + function getDefaultTicketQueueId() { return $this->get('default_ticket_queue'); } @@ -1271,6 +1276,7 @@ class OsticketConfig extends Config { 'max_open_tickets'=>$vars['max_open_tickets'], 'enable_captcha'=>isset($vars['enable_captcha'])?1:0, 'auto_claim_tickets'=>isset($vars['auto_claim_tickets'])?1:0, + 'collaborator_ticket_visibility'=>isset($vars['collaborator_ticket_visibility'])?1:0, 'show_related_tickets'=>isset($vars['show_related_tickets'])?1:0, 'allow_client_updates'=>isset($vars['allow_client_updates'])?1:0, 'ticket_lock' => $vars['ticket_lock'], diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php index 28c7605bb99945bf893df6fbbb6bb4625aeb5ec5..b7e536fc3ec61ef6e63735dedae01c2edb412224 100644 --- a/include/client/tickets.inc.php +++ b/include/client/tickets.inc.php @@ -77,7 +77,11 @@ if ($settings['status']) // unique values $visibility = $basic_filter->copy() ->values_flat('ticket_id') - ->filter(array('user_id' => $thisclient->getId())) + ->filter(array('user_id' => $thisclient->getId())); + +// Add visibility of Tickets where the User is a Collaborator if enabled +if ($cfg->collaboratorTicketsVisibility()) + $visibility = $visibility ->union($basic_filter->copy() ->values_flat('ticket_id') ->filter(array('thread__collaborators__user_id' => $thisclient->getId())) diff --git a/include/i18n/en_US/config.yaml b/include/i18n/en_US/config.yaml index 32783896b5ee0083d2ea481d79a851c787fc0d3a..4d1f67f410f8f2561a68d39affc5d88e93a91559 100644 --- a/include/i18n/en_US/config.yaml +++ b/include/i18n/en_US/config.yaml @@ -67,6 +67,7 @@ core: assigned_alert_team_lead: 0 assigned_alert_team_members: 0 auto_claim_tickets: 1 + collaborator_ticket_visibility: 1 show_related_tickets: 1 show_assigned_tickets: 1 show_answered_tickets: 0 diff --git a/include/i18n/en_US/help/tips/settings.ticket.yaml b/include/i18n/en_US/help/tips/settings.ticket.yaml index b13bd17c4f3bc9b2739ddb52f02c69c2d3ca497a..7d4a72fd2981ca81347d052670c93e470adac79e 100644 --- a/include/i18n/en_US/help/tips/settings.ticket.yaml +++ b/include/i18n/en_US/help/tips/settings.ticket.yaml @@ -94,6 +94,15 @@ claim_tickets: <br><br> Reopened tickets are always assigned to the last respondent. +collaborator_ticket_visibility: + title: Collaborator Tickets Visibility + content: > + If Enabled, Users will have visibility to ALL Tickets they participate in + when signing into the Web Portal. + <br><br> + If Disabled, Users will only be able to see their own Tickets + when signing into the Web Portal. + assigned_tickets: title: Assigned Tickets content: > diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php index dd259ea8a1e350c30344ac528e42a3453d423de8..210b6d3f319dd33f9bb6bc20e3b8dca22348b2c5 100644 --- a/include/staff/settings-tickets.inc.php +++ b/include/staff/settings-tickets.inc.php @@ -206,6 +206,13 @@ if(!($maxfileuploads=ini_get('max_file_uploads'))) <?php echo __('Enable'); ?> <i class="help-tip icon-question-sign" href="#claim_tickets"></i> </td> </tr> + <tr> + <td><?php echo __('Collaborator Tickets Visibility'); ?>:</td> + <td> + <input type="checkbox" name="collaborator_ticket_visibility" <?php echo $config['collaborator_ticket_visibility']?'checked="checked"':''; ?>> + <?php echo __('Enable'); ?> <i class="help-tip icon-question-sign" href="#collaborator_ticket_visibility"></i> + </td> + </tr> <tr> <th colspan="2"> <em><b><?php echo __('Attachments');?></b>: <?php echo __('Size and maximum uploads setting mainly apply to web tickets.');?></em>