diff --git a/include/class.ticket.php b/include/class.ticket.php
index 6431301583b0d7b4a6021cc79025258818bbdf9a..c8b2c7bd096b708bce5be669ff88c4be0cbbe237 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1797,7 +1797,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()))
@@ -1807,7 +1807,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.' ) ';