osTicket 1.9.4 – Show Due Date Column

Andrew (another one) got in contact with me asking if I could help him to how to show an extra column in osTicket 1.9.4, he tired to follow my previous post without much luck (after rereading it, I’m surprised if that’s ever helped anyone!).

He wanted the ability to see and sort by a “Due Date” column. Well it turns out to be a really easy feature to add.

Here is a GitHub Gist of the modified tickets.inc.php

Instructions for use:

  1. Backup /[osticket-install]/include/staff/tickets.inc.php
  2. Download the following file and copy it to /[osticket-install]/include/staff/tickets.inc.php
  3. Test! (If it break badly, I’m sorry, please restore your backup file).

As a side note, it also got me to finally setup a github account!

Here is the step by step instructions:

  1. Update the sort options ~Line 170.Effectively what we are doing here is adding the ‘duedate’=>’duedate’ to the array. So replace $sortOptions with below:
    [gist id = “c66ef9d90bdcbf874685” file = “step-1.php” width = “90%”]
  2. Add the heading to the table ~Line 374
    Just add the following line in after the closing </th> tag for the line <a <?php echo $date_sort; ?>………
    [gist id = “c66ef9d90bdcbf874685” file = “step-2.php” width = “90%”]
  3. Add the data row to the table ~ Line 468
    After the <td align=”center” nowrap><?php echo Format::db_datetime($row[‘effective_date’]); ?></td> add:
    [gist id = “c66ef9d90bdcbf874685” file = “step-3.php” width = “90%”]
  4. Finally fix up the footer ~ Line 506
    Change <td colspan=”7″> to:
    [gist id = “c66ef9d90bdcbf874685” file = “step-4.php” width = “90%]
  5. Thats it!

Don’t break it!

 

12 thoughts on “osTicket 1.9.4 – Show Due Date Column”

  1. Andrew, again, your tutorial works great. I’ve found myself needing to modify the SQL though because when I want to display the value of a custom list item I’m currently getting the numerical value that OsTicket is assigning within the database. Right now I’m just seeing a # such as 24 that corresponds to a list/list item within the database. Do you know if a post online that already shows all the correct tables to query? If not, I’ll send you a message once I have it figured out.

  2. Hey Andrew,
    I hope you get your hands around updating to version 1.9.7 pls… we so frikking need this brilliant mod of yours.

  3. Hello, thanks for this solution!

    But I’ve got one question. When a ticket is overdue, I want that the due time is colored red. When a ticket is nearly overdue (in 3 hours or something) I want that the due timet is colored yellow. How I can do this? Do you have any solution for that?

    I hope you can help me.

    1. Without looking at it in detail, I assume you could do something like this (note this isn’t tested code, or even really code at all, just an idea).

      Inside the loop that prints out the rows you have access to the variable $row[‘duedate’] which I would assume (would have to look in the database) is just a standard Unix timestamp (Seconds since 1/1/1970). Therefore you could do a simple bit of logic with:
      if(current_timestamp_of_now is > $row[‘duedate’]) then
      do something (add a span tag with an inline style of red or something)
      elseif(current_timestamp_of_now_less_3_hours is > $row[‘duedate’]) then
      do something else (add a span tag with an inline style of yellow)
      else
      do nothing

      I might have my < and > mixed around but you get the idea.

Leave a Reply

Your email address will not be published. Required fields are marked *