From 30c189faa6547a0a0d47e77c483f4888e5fb7e25 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 8 Jan 2014 13:15:50 -0600
Subject: [PATCH] Fix ticket queue counts for limited users

---
 include/class.ticket.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 25733c301..199e4356a 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1833,7 +1833,7 @@ class Ticket {
         if(!$staff || (!is_object($staff) && !($staff=Staff::lookup($staff))) || !$staff->isStaff())
             return null;
 
-        $where = array();
+        $where = array('ticket.staff_id='.db_input($staff->getId()));
         $where2 = '';
 
         if(($teams=$staff->getTeams()))
@@ -1843,7 +1843,7 @@ class Ticket {
             $where[] = 'ticket.dept_id IN('.implode(',', db_input($depts)).') ';
 
         if(!$cfg || !($cfg->showAssignedTickets() || $staff->showAssignedTickets()))
-            $where2 =' AND (ticket.staff_id=0 OR ticket.staff_id='.db_input($staff->getId()).') ';
+            $where2 =' AND ticket.staff_id=0 ';
         $where = implode(' OR ', $where);
         if ($where) $where = 'AND ( '.$where.' ) ';
 
-- 
GitLab