Insert Last Update Column in Ticket List Page in osTicket v1.6 RC5

Somebody in osTicket Discussion Forum asked a question about how to insert the Last Update column in the Ticket List page in osTicket System v1.6 RC5. So I made this modification to implement this feature into v1.6 RC5. This modification being made to provide the conclusion about which code should be modified based on that topic above, since there are two version modification on that topic. The first one is to display the who’s turn to respon on the next action, and the second one is to display the information about the last update for each ticket. So, this modification intended for the second one modification.

  1. Open your \include\class.ticket.php file, and find this code:

    264
    
        function getLastMessageDate() {

    before that line, please insert this following code:

    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    
        function getLastReplyRespondent() {
            $lastmsgdate = strtotime($this->getLastMessageDate());
            $lastresdate = strtotime($this->getLastResponseDate());
     
            if ($lastmsgdate <= $lastresdate) {
                return 0;
            } else {
                return 1;
            }
        }
  2. Open your \include\staff\tickets.inc.php file, and find this code:

    376
    377
    
                    <a href="tickets.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Date</a></th>
    	        <th width="280">Subject</th>

    then replace with this following code:

    376
    377
    378
    379
    
            <a href="tickets.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Date</a></th>
            <th nowrap>Last Updated</th>
            <th>By</th>
            <th width="250">Subject</th>

    Find again this code:

    414
    415
    416
    417
    
                    <td align="center" nowrap><?=Format::db_date($row['created'])?></td>
                    <td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?> 
                        href="tickets.php?id=<?=$row['ticket_id']?>"><?=$subject?></a>
                        &nbsp;<?=$row['attachments']?"<span class='Icon file'>&nbsp;</span>":''?></td>

    then replace with this following code:

    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    
                    <td align="center" nowrap><?=Format::db_datetime($row['created'])?></td>
     
            <? $ticket = new Ticket($row['ticket_id']); 
               if ($ticket->getLastReplyRespondent()) {?> 
                <td nowrap style="color:red;font-weight:bold">
                <?=Format::db_datetime($ticket->getLastMessageDate())?></td>
                <td style="color:red;font-weight:bold">Client
            <?} else {?>
                <td nowrap><?=Format::db_datetime($ticket->getLastResponseDate())?></td>
                <td>Staff
            <?}
            ?> </td>
     
                    <td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?> 
                        href="tickets.php?id=<?=$row['ticket_id']?>"><?=$subject?></a>
                        &nbsp;<?=$row['attachments']?"<span class='Icon file'>&nbsp;</span>":''?></td>

Please note that this modification applied only for osTicket v1.6 RC5.

Share

888 viewsPrint This Post Print This Post

Comments

  1. yarfik says:

    Maap mas, kok g berubah ya?

    Saya sdh mengikuti langkah2 di atas, file yang sy edit udah sama, versi osticketnya juga sama juga 1.6 RC5 tapi g ada efeknya ya? apa sy salah file ya?

    Trims.

  2. Maksudnya tidak berubah itu seperti apa ya? Apakah sama sekali tidak ada dua kolom baru yang bernama “Last Updated” dan “By” di halaman yang menampilkan daftar tiket, atau kolom tersebut sudah muncul tapi tidak ada informasi di kedua kolom tadi?

    Sebagai informasi, modifikasi ini sudah saya coba ulang dan berhasil sebagaimana mestinya. Salah satu feedback yang mengkonfirmasikan telah berhasil mengimplementasikan modifikasi tersebut, disampaikan oleh salah seorang member di Forum osTicket.

    Coba pastikan sekali lagi bahwa semua langkah-langkah di atas sudah diikuti dengan tepat pada file yang bertalian.

  3. yarfik says:

    Iya mas, ternyata saya salah folder *_*

    Setelah nanya lagi ke klien, baru di kasih folder yang benar. Setelah mengikuti langkah-langkah di atas, akhirnya scriptnya bisa berjalan lancar.

    Makasih buat sharing scriptnya dan responya.

    Salam kenal
    Yarfik

    nb: Saya baru pertama kali utakatik ost jadi masih agak oon.. :)

  4. Syukurlah kalau begitu.

    Salam kenal kembali juga, deh… :-)

  5. Piotr says:

    Hello,

    Is it possible to sort ticket by ‘Latest update’ column? It will be clearly for me.
    Thank you in advance for any help.

    Piotr

  6. @Piotr

    At the moment, no. The reason for this is since the “Last Updated” returned from the getLastReplyRespondent() or getLastMessageDate() for each record that we derived from the loop block throught the recordset. It meant that those both values came from ticket_response and ticket_message tables and displayed them on “Last Updated” column. ;-)

  7. fackeid says:

    hi
    this is really very very nice mod.
    i do have following issues in it -

    Along with last updates column, i got “By” column as well but that does not reflect the staff name, instead it shows only STAFF
    Also it is possible to show the time in 24 hours format?

Speak Your Mind

*


*