This is a variation on webpragmatists original "Assigned To" MOD as seen on the osTicket forum.
The following is what I have for all of my entries. I will include one line prior to the code so you can search for where to enter it.
include/staff/tickets.inc.php
(Remember to comment out the original sortOptions)
//I admit this crap sucks…but who cares?? $sortOptions=array('date'=>'ticket.created','ID'=> 'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','ass'=>'firstname'); //$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');
(Remember to comment out the first entry for qselect and qfrom)
$pagelimit=$pagelimit?$pagelimit:PAGE_LIMIT; //true default…if all fails. $page=($_GET['p'] && is_numeric($_GET['p']))?$_GET['p']:1; $qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,ticket.email,dept_name,staff.firstname,staff.lastname '. ',ticket.status,ticket.source,isoverdue,ticket.created,pri.*,count(attach.attach_id) as attachments '; $qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '. // ' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '. // ' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '. ' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th> <th width="150" ><a href="tickets.php?sort=ass&order=<?=$negorder?><?=$qstr?>" title="Sort By Assignee <?=$negorder?>">Assigned To</a></th>
<td nowrap><?=Format::truncate($row['dept_name'],30)?></td> <td nowrap><?=($row['firstname']) ? $row['firstname'] : ' ';?> <?=($row['lastname']) ? $row['lastname'] : '';?></td>
You should now be able to refresh your Ticket page and have a nice "Assigned To" column. Give it a go!
Now you may notice that after you close a ticket that is assigned to someone that assignment gets removed. I have found this undesirable so we’ll edit the following
include/class.ticket.php
remove staff_id=0 from the following line:
$sql= 'UPDATE '.TICKET_TABLE.' SET status='.db_input('closed').',isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '.
This will still make the ticket show up under "My Tickets" (even when closed) in order to get it to stop doing that (if you desire), then change the following entry from:
include/staff/tickets.inc.php
$qwhere.=' AND ticket.staff_id='.db_input($staffId);
to:
$qwhere.=' AND ticket.status="open" AND ticket.staff_id='.db_input($staffId);
You’ll also need to change the following (otherwise it will count that you have tickets assigned but won’t list them thus confusing everyone).
scp/tickets.php
'LEFT JOIN '.TICKET_TABLE.' assigned ON assigned.ticket_id=ticket.ticket_id AND assigned.staff_id='.db_input($thisuser->getId());
To:
'LEFT JOIN '.TICKET_TABLE.' assigned ON assigned.ticket_id=ticket.ticket_id AND ticket.status=\'open\' AND assigned.staff_id='.db_input($thisuser->getId());