From b9fd3631a4f0a69c53b9d95b49e5a3f999094541 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 10 Aug 2015 09:34:39 -0500 Subject: [PATCH] tickets: Show disabled 'show assigned' setting If enabled globally. Also, keep the columns consistent on search results. Lastly, actually show _only_ unassigned tickets (not either unassiged to staff or team) --- include/class.staff.php | 4 +++- include/class.ticket.php | 2 +- .../i18n/en_US/help/tips/dashboard.my_profile.yaml | 13 +++++++++---- include/staff/profile.inc.php | 7 ++++--- include/staff/tickets.inc.php | 8 ++++---- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/class.staff.php b/include/class.staff.php index 2a7bca5f6..a3b214593 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -615,7 +615,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { $this->signature = Format::sanitize($vars['signature']); $this->timezone = $vars['timezone']; $this->locale = $vars['locale']; - $this->show_assigned_tickets = isset($vars['hide_assigned_tickets'])?0:1; + if (!$cfg->showAssignedTickets()) + // Allow local unsetting if unset globally + $this->show_assigned_tickets = isset($vars['show_assigned_tickets']) ? 1 : 0; $this->max_page_size = $vars['max_page_size']; $this->auto_refresh_rate = $vars['auto_refresh_rate']; $this->default_signature_type = $vars['default_signature_type']; diff --git a/include/class.ticket.php b/include/class.ticket.php index 80eafde8e..fa4024056 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2762,7 +2762,7 @@ implements RestrictedAccess, Threadable { if(!$staff->showAssignedOnly() && ($depts=$staff->getDepts())) //Staff with limited access just see Assigned tickets. $where[] = 'ticket.dept_id IN('.implode(',', db_input($depts)).') '; - if(!$cfg || !($cfg->showAssignedTickets() || $staff->showAssignedTickets())) + if (($cfg && !$cfg->showAssignedTickets()) && !$staff->showAssignedTickets()) $where2 =' AND (ticket.staff_id=0 OR ticket.team_id=0)'; $where = implode(' OR ', $where); if ($where) $where = 'AND ( '.$where.' ) '; diff --git a/include/i18n/en_US/help/tips/dashboard.my_profile.yaml b/include/i18n/en_US/help/tips/dashboard.my_profile.yaml index 821fc0bbe..b8c40b07c 100644 --- a/include/i18n/en_US/help/tips/dashboard.my_profile.yaml +++ b/include/i18n/en_US/help/tips/dashboard.my_profile.yaml @@ -54,10 +54,15 @@ default_paper_size: show_assigned_tickets: title: Show Assigned Tickets content: > - Enable this to hide your name from the <span class="doc-desc-title">Open - Tickets</span> queue for those tickets which you have been assigned. Upon - hiding, the <span class="doc-desc-title">Department</span> name to which - you belong will replace where your name would normally be displayed. + <p> + Enabling this option will override the global setting to hide + assigned tickets from the open queues. + </p> + <p class="info-banner"> + <i class="icon-info-sign"></i> + This setting is only available when assigned tickets are excluded + globally. + </p> password: title: Password diff --git a/include/staff/profile.inc.php b/include/staff/profile.inc.php index d55e0c0e9..6fc6a2c75 100644 --- a/include/staff/profile.inc.php +++ b/include/staff/profile.inc.php @@ -133,9 +133,10 @@ if ($avatar->isChangeable()) { ?> <tr> <td colspan="2"> <label class="checkbox"> - <input type="checkbox" name="hide_assigned_tickets" - <?php echo (!$staff->show_assigned_tickets) ? 'checked="checked"' : ''; ?> /> - <?php echo __('Exclude assigned tickets on open queue.'); ?> + <input type="checkbox" name="show_assigned_tickets" + <?php echo $cfg->showAssignedTickets() ? 'disabled="disabled" ' : ''; ?> + <?php echo $staff->show_assigned_tickets ? 'checked="checked"' : ''; ?> /> + <?php echo __('Show assigned tickets on open queue.'); ?> <i class="help-tip icon-question-sign" href="#show_assigned_tickets"></i> </label> <label class="checkbox"> diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 936dd1901..595a5205a 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -159,11 +159,11 @@ case 'open': // Open queues _except_ assigned should respect showAssignedTickets() // settings -if ($status == 'open' && $queue_name != 'assigned') { - $hideassigned = ($cfg && !$cfg->showAssignedTickets()) || !$thisstaff->showAssignedTickets(); +if ($status != 'closed' && $queue_name != 'assigned') { + $hideassigned = ($cfg && !$cfg->showAssignedTickets()) && !$thisstaff->showAssignedTickets(); $showassigned = !$hideassigned; - if ($hideassigned) - $tickets->filter(Q::any(array('staff_id'=>0, 'team_id'=>0))); + if ($status == 'open' && $hideassigned) + $tickets->filter(array('staff_id'=>0, 'team_id'=>0)); else $tickets->values('staff__firstname', 'staff__lastname', 'team__name'); } -- GitLab