This mod - which adds a user's closed tickets to the My Tickets display, and adds a ticket total to the link - is a rewrite of (fidel's v1.6 mod), tested and working with v1.7.0. Note that the following patch should be applied at the TLD of your osTicket installation (using patch -p0 < ). Several files are affected:
include/class.ticket.php
include/staff/tickets.inc.php
scp/tickets.php
Note that my line numbers might differ from yours, and the order in which I apply this mod with others will most likely differ form the order in which you do.
The patch containing all changes:
--- include/class.ticket.php 2013-04-01 23.000000000 -0600
+++ include/class.ticket.php 2013-05-04 17.000000000 -0600
@@ -685,8 +707,8 @@
global $thisstaff;
$sql='UPDATE '.TICKET_TABLE.' SET closed=NOW(),isoverdue=0, duedate=NULL, updated=NOW(), status='.db_input('closed');
- if($thisstaff) //Give the closing staff credit.
- $sql.=', staff_id='.db_input($thisstaff->getId());
+ //if($thisstaff) //Give the closing staff credit.
+ // $sql.=', staff_id='.db_input($thisstaff->getId());
$sql.=' WHERE ticket_id='.db_input($this->getId());
@@ -1741,8 +1829,8 @@
if(!$staff || (!is_object($staff) && !($staff=Staff:($staff))) || !$staff->isStaff() || $cfg->getDBVersion())
return null;
- $sql='SELECT count(open.ticket_id) as open, count(answered.ticket_id) as answered '
- .' ,count(overdue.ticket_id) as overdue, count(assigned.ticket_id) as assigned, count(closed.ticket_id) as closed '
+ $sql='SELECT count(open.ticket_id) as open, count(answered.ticket_id) as answered, count(overdue.ticket_id) as overdue '
+ .' ,count(all_assigned.ticket_id) as all_assigned, count(assigned.ticket_id) as assigned, count(closed.ticket_id) as closed '
.' FROM '.TICKET_TABLE.' ticket '
.' LEFT JOIN '.TICKET_TABLE.' open
ON (open.ticket_id=ticket.ticket_id
@@ -1758,6 +1846,9 @@
ON (overdue.ticket_id=ticket.ticket_id
AND overdue.status=\'open\'
AND overdue.isoverdue=1) '
+ .' LEFT JOIN '.TICKET_TABLE.' all_assigned
+ ON (all_assigned.ticket_id=ticket.ticket_id
+ AND all_assigned.staff_id='.db_input($staff->getId()).')'
.' LEFT JOIN '.TICKET_TABLE.' assigned
ON (assigned.ticket_id=ticket.ticket_id
AND assigned.status=\'open\'
--- include/staff/tickets.inc.php 2013-05-03 09.000000000 -0600
+++ include/staff/tickets.inc.php 2013-05-03 09.000000000 -0600
@@ -39,7 +39,7 @@
$results_type='Overdue Tickets';
break;
case 'assigned':
- $status='open';
+ //$status='open';
$staffId=$thisstaff->getId();
$results_type='My Tickets';
break;
@@ -241,6 +241,12 @@
$order_by='priority_urgency ASC, effective_date DESC, ticket.created';
}
+// Sort "My Tickets" by status first, then same ordering as "Open"
+if(!strcasecmp($_REQUEST,'assigned') && !isset($_REQUEST)) {
+ $order_by = 'ticket.status ASC,ticket.lastresponse DESC,ticket.created';
+ $order = 'DESC';
+}
+
$order=$order?$order:'DESC';
if($order_by && strpos($order_by,',') && $order)
$order_by=preg_replace('/(?<!<!ASC|DESC),/', " $order,", $order_by);
@@ -417,6 +423,11 @@
$threadcount=$row;
if(!strcasecmp($row,'open') && !$row && !$row) {
$tid=sprintf('<b>>%s</b>',$tid);
+ $subject=sprintf('<b>%s</b>',$subject);
+ }
+ if(!strcasecmp($_REQUEST,'assigned') && !strcasecmp($row,'closed')) {
+ $tid=sprintf('<del>%s</del>',$tid);
+ $subject=sprintf('<del>%s</del>',$subject);
}
?>
<tr id="<?php echo $row; ?>">
--- scp/tickets.php 2013-04-01 23.000000000 -0600
+++ scp/tickets.php 2013-05-03 16.000000000 -0600
@@ -498,5 +500,5 @@
- $nav->addSubMenu(array('desc'=>'My Tickets ('.number_format($stats).')',
+ $nav->addSubMenu(array('desc'=>'My Tickets (Total : '.number_format($stats).' | Open : '.number_format($stats).')',
'title'=>'Assigned Tickets',
'href'=>'tickets.php?status=assigned',
'iconclass'=>'assignedTickets'),