diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 56093119ba4db6369ddac398dac11470a7f5d4e4..0e010879824f928bd2763f4cb6f58a16ab5c9fa8 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -124,16 +124,18 @@ class TicketsAjaxAPI extends AjaxController { } //Assignee - if($_REQUEST['assignee'] && strcasecmp($_REQUEST['status'], 'closed')) { + if(isset($_REQUEST['assignee']) && strcasecmp($_REQUEST['status'], 'closed')) { $id=preg_replace("/[^0-9]/", "", $_REQUEST['assignee']); $assignee = $_REQUEST['assignee']; - $where.= ' AND ( '; + $where.= ' AND ( ( ticket.status="open" '; if($assignee[0]=='t') - $where.=' (ticket.team_id='.db_input($id). ' AND ticket.status="open") '; + $where.=' AND ticket.team_id='.db_input($id); elseif($assignee[0]=='s') - $where.=' (ticket.staff_id='.db_input($id). ' AND ticket.status="open") '; - else - $where.=' (ticket.staff_id='.db_input($id). ' AND ticket.status="open") '; + $where.=' AND ticket.staff_id='.db_input($id); + elseif(is_numeric($id)) + $where.=' AND ticket.staff_id='.db_input($id); + + $where.=')'; if($_REQUEST['staffId'] && !$_REQUEST['status']) //Assigned TO + Closed By $where.= ' OR (ticket.staff_id='.db_input($_REQUEST['staffId']). ' AND ticket.status="closed") '; diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 64cd52cc7e6fcd215b3340f629eef3a7fdff5666..0d14cf4a52acfdcfd5a1e7d0a6a8ec919ac873f3 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -50,7 +50,7 @@ switch(strtolower($_REQUEST['status'])){ //Status is overloaded break; default: if(!$search) - $status='open'; + $_REQUEST['status']=$status='open'; } $qwhere =''; @@ -144,19 +144,21 @@ if($search): } //Assignee - if($_REQUEST['assignee'] && strcasecmp($_REQUEST['status'], 'closed')) { + if(isset($_REQUEST['assignee']) && strcasecmp($_REQUEST['status'], 'closed')) { $id=preg_replace("/[^0-9]/", "", $_REQUEST['assignee']); $assignee = $_REQUEST['assignee']; $qstr.='&assignee='.urlencode($_REQUEST['assignee']); - $qwhere.= ' AND ( '; + $qwhere.= ' AND ( + ( ticket.status="open" '; if($assignee[0]=='t') - $qwhere.=' (ticket.team_id='.db_input($id). ' AND ticket.status="open") '; + $qwhere.=' AND ticket.team_id='.db_input($id); elseif($assignee[0]=='s') - $qwhere.=' (ticket.staff_id='.db_input($id). ' AND ticket.status="open") '; - else - $qwhere.=' (ticket.staff_id='.db_input($id). ' AND ticket.status="open") '; + $qwhere.=' AND ticket.staff_id='.db_input($id); + elseif(is_numeric($id)) + $qwhere.=' AND ticket.staff_id='.db_input($id); + $qwhere.=' ) '; if($_REQUEST['staffId'] && !$_REQUEST['status']) { //Assigned TO + Closed By $qwhere.= ' OR (ticket.staff_id='.db_input($_REQUEST['staffId']). ' AND ticket.status="closed") '; @@ -579,7 +581,9 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting.. <fieldset class="owner"> <label for="assignee">Assigned To:</label> <select id="assignee" name="assignee"> - <option value="0">— Anyone —</option> + <option value="">— Anyone —</option> + <option value="0">— Unassigned —</option> + <option value="<?php echo $thisstaff->getId(); ?>">Me</option> <?php if(($users=Staff::getStaffMembers())) { echo '<OPTGROUP label="Staff Members ('.count($users).')">'; @@ -603,6 +607,7 @@ $negorder=$order=='DESC'?'ASC':'DESC'; //Negate the sorting.. <label for="staffId">Closed By:</label> <select id="staffId" name="staffId"> <option value="0">— Anyone —</option> + <option value="<?php echo $thisstaff->getId(); ?>">Me</option> <?php if(($users=Staff::getStaffMembers())) { foreach($users as $id => $name)