From 575a705d07aa69a0f527de65080d321e919228f6 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 4 Nov 2015 18:15:21 +0000
Subject: [PATCH] bug: My Tickets

Fix a bug where tickets assigned to ANY team and unassigned to an agent
showed up on My Tickets count.
---
 include/class.ticket.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index 6854f6c64..ddfcd3f04 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2840,7 +2840,11 @@ implements RestrictedAccess, Threadable {
                 $stats['overdue'] += $S['count'];
             if ($S['staff_id'] == $id)
                 $stats['assigned'] += $S['count'];
-            elseif ($S['team_id'] && $S['staff_id'] == 0)
+            elseif ($S['team_id']
+                    && $S['staff_id'] == 0
+                    && $teams
+                    && in_array($S['team_id'], $teams))
+                // Assigned to my team but uassigned to an agent
                 $stats['assigned'] += $S['count'];
         }
         return $stats;
-- 
GitLab