Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

[MOD] Show/Sort "Due Date" in Ticket View

Hi, falks!

Well, I'd like to add my first and very simple MOD which is useful at least for me. This mod allows to view tickets due date and also to sort due date by Acs or Desc.
click on the image to enlarge(will open in a new window)[/CENTER]

The First number of Line is for OST 1.6 RC5 and the second is for OST 1.6 stable.

With the help of christoph I've finaly made fully workable MOD.

If you still want this MOD here are the simple steps:):

Backup and then open for editing include/staff/

1. Find (line 172 / 182):


Betwen ,'dept'=>'dept_name' and ); add ,'duedate'=>'duedate'

2. At line 199 / 209 find:

$qselect = 'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,

Betwen = 'SELECT DISTINCT and ticket.ticket_id add ticket.duedate,

3. Find line 376 / 395:
[HTML]<?=$qstr?>" title="Sort By Date <?=$negorder?>">Date[/HTML]

After, add new line:
[HTML]<?=$qstr?>" title="Sort By Due Date <?=$negorder?>">Due Date[/HTML]

4. Find line 414 / 433:

After, add new line:
[HTML]<?=Format::db_date($row['duedate']) ? Format::db_date($row['duedate']) : ' ';?>[/HTML]


  • I've just started using osTicket and think its great, thanks for posting this mod, I need exactly this too, I have done the above and it works great but I can't make the date display properley either.

    Did you find out how to make the date display properly or does anyone else know how to?
  • Hi there!

    I'm pleased you liked this MOD, thanks.

    Wel, I've tried to fix the problem with date. At PhpMyAdmin's querry window I've made simple script working that changes date format:

    SELECT DATE_FORMAT(ticket.duedate,'%d.%m.%Y %H.%i.%S') FROM `ost_ticket` WHERE 1

    But when I insert the part "DATE_FORMAT(ticket.duedate,'%d.%m.%Y %H.%i.%S')" into the line 199 instead of previous "ticket.duedate" (watch the first post) I get header of OST and blank 'body'. There's an error and I can't fix it.

    Any ideas?:confused:
  • LPervak;13084 said:

    After, add new line:
    [HTML]<?=Format::db_datetime($row['duedate']) ? $row['duedate'] : ' ';?>[/HTML]
    Change this into :
    [HTML]<?=Format::db_date($row['duedate']) ? db_date($row['duedate']) : ' ';?>[/HTML]
  • christoph! Greate work, thanx for it! But ther's one thin you forgot to include in that code-string - "Format::".

    The code must be:

    [HTML]<?=Format::db_date($row['duedate']) ? Format::db_date($row['duedate']) : ' ';?>[/HTML]

    Works FINE!!!!
  • Great code .. Thanks

    simple and effective the way it should be :) Thanks for posting and sharing ! :D
  • Thanks very much for this

    These forums are just awesome. Just started using this program on the weekend and can already see how cool it is ... even better is that every time I have a question, seems someone has already asked and answered it for me!

    Thanks very much for this info - this was exactly what I was looking for on my install and the code worked really well.

  • Backwards

    My due date and date are backwards, I copied the code exactly, checked it 3 times and still its exactly how it shows up above. anybody know what is wrong? Its just the titles that are wrong place.

    Ticket Due Date Date
    579310 10/22/2011 10/31/2011

    should be
    Ticket Date Due Date
    579310 10/22/2011 10/31/2011

  • jcrutcher, watch the 3rd step more clearly. It seems, that you've changed strings position and your code most likely:

    [HTML]<?=$qstr?>" title="Sort By Date <?=$negorder?>">Due Date
    <?=$qstr?>" title="Sort By Date <?=$negorder?>">Date[/HTML]

    Just put "Due date" string after the "Date" string:

    [HTML]<?=$qstr?>" title="Sort By Date <?=$negorder?>">Date
    <?=$qstr?>" title="Sort By Date <?=$negorder?>">Due Date[/HTML]
  • Possible to add time along with due date ?

    LPervak, Thank you for such an awesome mod. its always not able the technical idea, its about integrating that along with a real world issue to solve a problem, i am new to OST, however i am really satisfied about it more than the features i like the mods that people like you create ! hats off. Open Source ROCKS !

    I have a query here., its a great feature for sorting the tickets by due date, also is it possible to bring in the time of those tickets also for the sort of the day. for Example : Say i arrange tickets via due date, and say i notice a 20 tickets having due date on 1/9/2012, now can i have the same thing along with the time of those tickets shown besides the same ? it will be awesome that way.
  • Yes, i mean "due time"
  • You can download the fully patched for 1.7RC2 at

    Feel free to email me if it is down or out of date.
  • 1.7RC4 Sort By Date

    Copy this file to includes/staff/ to add a "Sort by Due Date" column:
  • Tried with osTicket (v1.9.3)

    Got the headers but no data ! Darn !

  • This mod was written for 1.6, 1.9 is almost a completely different beast.
  • Here is a code diff for that file that works with 1.9.x .... I hope this is useful to some!  I didn't want to see the priority.  So I commented that out, but you can easily un-comment it if you want to see the priority.

    I also didn't mess with getting it to display the up and down arrows because it looks like I'd have to modify a different source file, and I wanted to keep it down to one file mod.

    - Mike

    This is a diff, which you can use with patch if you wish, or you can manually apply the changes too.  In case osTicket got modified from when I made the patch, that is.. (by hand is safer and it's not large.)


    osticket:/var/www# diff -u
    ---    2015-10-14 15:23:04.188621700 -0400
    +++    2015-10-14 15:16:50.672621700 -0400
    @@ -166,7 +166,7 @@
    -    'dept'=>'dept.dept_name');
    +    'dept'=>'dept.dept_name','duedate'=>'duedate');
    @@ -217,7 +217,8 @@
     $qselect ='SELECT ticket.ticket_id,tlock.lock_id,ticket.`number`,ticket.dept_id,ticket.staff_id,ticket.team_id '
         .' ,'
         .' ,email.address as email, dept.dept_name, status.state '
    -         .' , as status,ticket.source,ticket.isoverdue,ticket.isanswered,ticket.created ';
    +    .' , as status,ticket.source,ticket.isoverdue,ticket.isanswered,ticket.created '
    +    .' ,ticket.duedate';
     $qfrom=' FROM '.TICKET_TABLE.' ticket '.
            ' LEFT JOIN '.TICKET_STATUS_TABLE. ' status
    @@ -384,9 +385,12 @@
                             title="<?php echo sprintf(__('Sort by %s %s'), __('Status'), __($negorder)); ?>"><?php echo __('Status');?></a></th>
                 } else { ?>
    -                <th width="60" <?php echo $pri_sort;?>>
    +                <!--th width="60" <?php echo $pri_sort;?>>
                         <a <?php echo $pri_sort; ?> href="tickets.php?sort=pri&order=<?php echo $negorder; ?><?php echo $qstr; ?>"
    -                        title="<?php echo sprintf(__('Sort by %s %s'), __('Priority'), __($negorder)); ?>"><?php echo __('Priority');?></a></th>
    +                        title="<?php echo sprintf(__('Sort by %s %s'), __('Priority'), __($negorder)); ?>"><?php echo __('Priority');?></a></th-->
    +                <th width="60">
    +                    <a href="tickets.php?sort=duedate&order=<?php echo $negorder; ?><?php echo $qstr; ?>"
    +                        title="<?php echo sprintf(__('Sort by %s %s'), __('Due Date'), __($negorder)); ?>"><?php echo __('Due Date');?></a></th>
    @@ -487,7 +491,9 @@
                         echo "<td>$displaystatus</td>";
                     } else { ?>
                     <td class="nohover" align="center" style="background-color:<?php echo $row['priority_color']; ?>;">
    -                    <?php echo $row['priority_desc']; ?></td>
    +                    <!-- <?php echo $row['priority_desc']; ?>  Display due date instead of priority -->
    +                    <?php echo Format::db_date($row['duedate']); ?>
    +                </td>

  • edited May 2016

    @mlandis thanks for your implementation.

    It couldnt get it to work yet in 1.9.12. got some error, try it again when i have more time :)


  • edited May 2016

    I got it fixed with adding it as a new row instead of removing the priority row. Big thanks.

                } else { ?>
                    <th width="60" <?php echo $pri_sort;?>>
                        <a <?php echo $pri_sort; ?> href="tickets.php?sort=pri&order=<?php echo $negorder; ?><?php echo $qstr; ?>"
                            title="<?php echo sprintf(__('Sort by %s %s'), __('Priority'), __($negorder)); ?>"><?php echo __('Priority');?></a>
         <!--  Add DueDate for Ticket Status -->
          <th width="60">
                        <a href="tickets.php?sort=duedate&order=<?php echo $negorder; ?><?php echo $qstr; ?>"
                            title="<?php echo sprintf(__('Sort by %s %s'), __('Due Date'), __($negorder)); ?>"><?php echo __('Due Date');?></a>


                    <td class="nohover" align="center" style="background-color:<?php echo $row['priority_color']; ?>;">
                        <?php echo $row['priority_desc']; ?></td>
        <!--  Add DueDate for Ticket Status -->
        <td class="nohover" align="center">
                          <?php echo Format::db_date($row['duedate']); ?> 

        <!-- End  Add DueDate for Ticket Status --> 


Sign In or Register to comment.