diff --git a/include/class.search.php b/include/class.search.php index 3faf623bbfd7872e807a9528a9f00a7466d5e490..68076e619847a82a9ee9bba0736b98fe3cdd0623 100644 --- a/include/class.search.php +++ b/include/class.search.php @@ -887,11 +887,11 @@ class AssigneeChoiceField extends ChoiceField { $Q = new Q(); switch ($method) { - case '!assigned': - $Q->negate(); case 'assigned': - $Q->add(array('team_id__gt' => 0, - 'staff_id__gt' => 0)); + $Q->negate(); + case '!assigned': + $Q->add(array('team_id' => 0, + 'staff_id' => 0)); break; case '!includes': $Q->negate(); diff --git a/include/class.ticket.php b/include/class.ticket.php index be76545652c1dba2d5725b1a7447a6b29d8cb0b9..7caac30d9b936543bcf5df2ff6ed503cc01fc9c9 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2365,7 +2365,7 @@ class Ticket { $where[] = 'ticket.dept_id IN('.implode(',', db_input($depts)).') '; if(!$cfg || !($cfg->showAssignedTickets() || $staff->showAssignedTickets())) - $where2 =' AND ticket.staff_id=0 '; + $where2 =' AND (ticket.staff_id=0 OR ticket.team_id=0)'; $where = implode(' OR ', $where); if ($where) $where = 'AND ( '.$where.' ) '; @@ -2383,7 +2383,7 @@ class Ticket { ON (ticket.status_id=status.id AND status.state=\'open\') ' .'WHERE ticket.isanswered = 1 ' - . $where + . $where . ($cfg->showAnsweredTickets() ? $where2 : '') .'UNION SELECT \'overdue\', count( ticket.ticket_id ) AS tickets ' .'FROM ' . TICKET_TABLE . ' ticket ' diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 3b7febeaf1915961ad5cc5153ba39b5c89e0e774..c0f3a1bf971c66766c3a1f854bc1cf492dd1dea0 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -49,7 +49,7 @@ case 'open': if (!$cfg->showAnsweredTickets()) $tickets->filter(array('isanswered'=>0)); if (!$cfg || !($cfg->showAssignedTickets() || $thisstaff->showAssignedTickets())) - $tickets->filter(array('staff_id'=>0)); + $tickets->filter(Q::any(array('staff_id'=>0, 'team_id'=>0))); break; }