From e4f4127af7728b8e14588c3f1e2bd5997b1dcafc Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 7 Aug 2015 12:12:23 -0500 Subject: [PATCH] tickets: Fix 'show_assigned_tickets' preference and setting --- include/class.staff.php | 2 +- include/staff/profile.inc.php | 13 ++++++------- include/staff/tickets.inc.php | 18 ++++++++++++------ scp/css/scp.css | 1 + 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/class.staff.php b/include/class.staff.php index ee930e581..2a7bca5f6 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -615,7 +615,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { $this->signature = Format::sanitize($vars['signature']); $this->timezone = $vars['timezone']; $this->locale = $vars['locale']; - $this->show_assigned_tickets = isset($vars['show_assigned_tickets'])?1:0; + $this->show_assigned_tickets = isset($vars['hide_assigned_tickets'])?0:1; $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/staff/profile.inc.php b/include/staff/profile.inc.php index 85a7a1338..d55e0c0e9 100644 --- a/include/staff/profile.inc.php +++ b/include/staff/profile.inc.php @@ -132,14 +132,13 @@ if ($avatar->isChangeable()) { ?> </tr> <tr> <td colspan="2"> - <label> - <input type="checkbox" name="show_assigned_tickets" - <?php echo ($staff->show_assigned_tickets) ? 'checked="checked"' : ''; ?> /> - <?php echo __('Show assigned tickets on open queue.'); ?> - </label> + <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.'); ?> <i class="help-tip icon-question-sign" href="#show_assigned_tickets"></i> - <br/> - <label> + </label> + <label class="checkbox"> <input type="checkbox" name="onvacation" <?php echo ($staff->onvacation) ? 'checked="checked"' : ''; ?> /> <?php echo __('Vacation Mode'); ?> diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 063feee30..d74dfc7c0 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -40,7 +40,7 @@ case 'closed': $status='closed'; $results_type=__('Closed Tickets'); $showassigned=true; //closed by. - $tickets->values('staff__firstname', 'staff__lastname', 'team__name', 'team_id'); + $tickets->values('staff__firstname', 'staff__lastname', 'team__name'); $queue_sort_options = array('closed', 'priority,due', 'due', 'priority,updated', 'priority,created', 'answered', 'number', 'hot'); break; @@ -146,19 +146,25 @@ case 'search': case 'open': $status='open'; $results_type=__('Open Tickets'); - $showassigned = ($cfg && $cfg->showAssignedTickets()) || $thisstaff->showAssignedTickets(); if (!$cfg->showAnsweredTickets()) $tickets->filter(array('isanswered'=>0)); - if (!$showassigned) - $tickets->filter(Q::any(array('staff_id'=>0, 'team_id'=>0))); - else - $tickets->values('staff__firstname', 'staff__lastname', 'team__name'); $queue_sort_options = array('priority,updated', 'updated', 'priority,due', 'due', 'priority,created', 'answered', 'number', 'hot'); break; } +// Open queues _except_ assigned should respect showAssignedTickets() +// settings +if ($status == 'open' && $queue_name != 'assigned') { + $hideassigned = ($cfg && !$cfg->showAssignedTickets()) || !$thisstaff->showAssignedTickets(); + $showassigned = !$hideassigned; + if ($hideassigned) + $tickets->filter(Q::any(array('staff_id'=>0, 'team_id'=>0))); + else + $tickets->values('staff__firstname', 'staff__lastname', 'team__name'); +} + // Apply primary ticket status if ($status) $tickets->filter(array('status__state'=>$status)); diff --git a/scp/css/scp.css b/scp/css/scp.css index 12389fb26..f0624c0e7 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1412,6 +1412,7 @@ i.help-tip { vertical-align: inherit; color: #aaa; opacity: 0.8; + text-indent: initial; } i.help-tip:hover { color: orange !important; -- GitLab