Home > osTicket > Order Tickets by LastMessage for Client in My Tickets Page of osTicket v1.6 RC5

Order Tickets by LastMessage for Client in My Tickets Page of osTicket v1.6 RC5

Today I received a new request about how to order by LastMessage field in My Tickets page of osTicket v1.6 RC5. Here is the quote of the topic:

Hello here is my problem.
I want to order the tickets in Tickets -> My Tickets menu in order to have le last tickets in which the client send another message on the top of the list instead of a list ordered by date of creation.

I’m trying to change that because my custumer service employees usually have more than 300 mails opened and its better if the last updated tickets are on the top instead of everywhere on the list.So the will be able to answer easier and faster .

Thanks for the help and sorry for my english

i’m using 1.6 RC5 version

So I made modification to make this request comes true. The final result I made is now there is two new columns in the list of ticket. They are: Last Response and Last Message, and by default, the list will be ordered by Last Message. You are able to sort the list based on those two new fields or columns.

  1. Open \include\client\tickets.inc.php file, and find this code:

    28
    
    $sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_id','dept'=>'dept_name');

    then replace with this following code:

    28
    
    $sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','lastresp'=>'lastresponse','lastmsg'=>'lastmessage','pri'=>'priority_id','dept'=>'dept_name');
  2. Find again this code:

    42
    
    $order_by =$order_by?$order_by:'ticket.created';

    then replace with this following code:

    42
    
    $order_by =$order_by?$order_by:'ticket.lastmessage';
  3. Find again this code:

    47
    48
    
    $qselect = 'SELECT ticket.ticket_id,ticket.ticketID,ticket.dept_id,isanswered,ispublic,subject,name,email '.
               ',dept_name,status,source,priority_id ,ticket.created ';

    then replace with this following code:

    47
    48
    
    $qselect = 'SELECT ticket.ticket_id,ticket.ticketID,ticket.dept_id,isanswered,ispublic,subject,name,email '.
               ',dept_name,status,source,priority_id, ticket.created, ticket.lastresponse, ticket.lastmessage ';
  4. Find again this code:

    92
    93
    
    	        <th width="100">
                    <a href="view.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Create Date</a></th>

    then replace with this following code:

    92
    93
    94
    95
    96
    97
    
    	        <th width="100">
                    <a href="view.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Create Date</a></th>
                    <th>
                    <a href="view.php?sort=lastresp&order=<?=$negorder?><?=$qstr?>" title="Sort by Last Response <?=$negorder?>">Last Response</a></th>
                    <th>
                    <a href="view.php?sort=lastmsg&order=<?=$negorder?><?=$qstr?>" title="Sort by Last Message <?=$negorder?>">Last Message</a></th>
  5. Find again this code:

    118
    
                    <td nowrap>&nbsp;<?=Format::db_date($row['created'])?></td>

    then replace with this following code:

    118
    119
    120
    
                    <td nowrap>&nbsp;<?=Format::db_date($row['created'])?></td>
                    <td nowrap>&nbsp;<?=Format::db_date($row['lastresponse'])?></td>
                    <td nowrap>&nbsp;<?=Format::db_date($row['lastmessage'])?></td>

Hopefully this is helpful.

  • Share/Bookmark
160 views Print This Post Print This Post

  1. john
    October 9th, 2009 at 02:03 | #1

    I tried to install this mod and it crash the site, I did notice that when I was moding it I have somethings that are different. I just wanted to add a last updates tab to the tickets.

  2. October 9th, 2009 at 09:49 | #2

    I have tested this modification before, and this worked fine only for client-side.

    If you have already done some modification by yourself, please make sure not to replace all of your modification code with the modification I made.

    You have to ensure the part that should be modified according the change that I made. Sorry for not to mention “backup first before doing this modification”, since I assume you should always do that.

  3. john
    October 9th, 2009 at 20:34 | #3

    I did but I tried to install it on the staff side that is the problem then, is there any way to add just a last updated column to the staff side?

  4. October 10th, 2009 at 08:58 | #4

    I have already created the same modification for staff side. Please follow this link: Order Tickets by LastMessage for Staff in My Tickets Page of osTicket v1.6 RC5. Hopefully this will help you.

  1. No trackbacks yet.