diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index cdb1a71ef633b289a9c030184ccac51eb66048dc..f509ad5e8407c5ceafb8f054c790c62da224accb 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -159,7 +159,7 @@ class TicketsAjaxAPI extends AjaxController { } //Assignee - if(isset($req['assignee']) && strcasecmp($req['status'], 'closed')) { + if($req['assignee'] && strcasecmp($req['status'], 'closed')) { # assigned-to $id=preg_replace("/[^0-9]/", "", $req['assignee']); $assignee = $req['assignee']; $where.= ' AND ( ( status.state="open" '; @@ -167,25 +167,25 @@ class TicketsAjaxAPI extends AjaxController { $where.=' AND ticket.team_id='.db_input($id); $criteria['team_id'] = $id; } - elseif($assignee[0]=='s') { + elseif($assignee[0]=='s' || is_numeric($id)) { $where.=' AND ticket.staff_id='.db_input($id); $criteria['staff_id'] = $id; } - elseif(is_numeric($id)) - $where.=' AND ticket.staff_id='.db_input($id); $where.=')'; if($req['staffId'] && !$req['status']) //Assigned TO + Closed By $where.= ' OR (ticket.staff_id='.db_input($req['staffId']). ' AND status.state IN("resolved", "closed")) '; - elseif(isset($req['staffId'])) // closed by any + elseif($req['staffId']) // closed by any $where.= ' OR status.state IN("resolved", "closed") '; $where.= ' ) '; - } elseif($req['staffId']) { + } elseif($req['staffId']) { # closed-by $where.=' AND (ticket.staff_id='.db_input($req['staffId']).' AND status.state IN("resolved", "closed")) '; + $criteria['state__in'] = array('resolved','closed'); + $criteria['staff_id'] = $req['staffId']; } //dates diff --git a/include/class.search.php b/include/class.search.php index 9e3a380efbfc081c42fe27ddf5b32a95f7f244d4..c3b2b2c1e0cb2ef30aef3ddd43cadc53d2bf15d1 100644 --- a/include/class.search.php +++ b/include/class.search.php @@ -308,8 +308,12 @@ class MysqlSearchBackend extends SearchBackend { case 'state': $where[] = 'A2.state = '.db_input($value); break; + case 'state__in': + $where[] = 'A2.state IN ('.implode(',',db_input($value)).')'; + break; case 'topic_id': case 'staff_id': + case 'team_id': case 'dept_id': case 'user_id': case 'isanswered': diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 671600b785e20d90df39173482da78c8a5803d9f..a5ad1dcdda5758228392cd5c45c2652406f48bf8 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -591,7 +591,7 @@ if ($results) { <select id="assignee" name="assignee"> <option value="">— <?php echo __('Anyone');?> —</option> <option value="0">— <?php echo __('Unassigned');?> —</option> - <option value="<?php echo $thisstaff->getId(); ?>"><?php echo __('Me');?></option> + <option value="s<?php echo $thisstaff->getId(); ?>"><?php echo __('Me');?></option> <?php if(($users=Staff::getStaffMembers())) { echo '<OPTGROUP label="'.sprintf(__('Agents (%d)'),count($users)).'">';