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

External Reporting via PHP

Hi, for basic monitoring i have written a bit of PHP that results in below, however i like to monitor the re-opened tickets as a way of monitoring the quality of the close. However we get a lot of people re-opening tickets to say thanks, which is great but it does mess up the stats. My question really is if there is a way to report a closed reason, for example we have a normal closed, but if we could have a "re-closed on thanks" option and then not to report on these?

Probably not possible but though I'd ask if anybody has any ideas?


  • You could maybe add another ticket status and filter based on that or you could check if there’s a comment associated with the close.
  • Hi Micke, do you off the top of your head have a line of SQL that would check if the ticket thread contains say "Re-closed after thank you message" as i am looking at the structure of the tables and i would have just have ran a query against ost_ticket for reopened and on  ost_thread_entry where body contains "Re-closed after thank you message" but there are no corresponding table id's to do a join on, i would have normally used ticket_id?

    Any help appreciated.

  • For anybody interested i found the solution, we are going to ask staff to close tickets with a canned response and then report on the closed reopened tickets and then the reopened but closed with the canned response and just minus them.

    Get all re-opened tickets
    SELECT COUNT(ticket_id) FROM ost_ticket WHERE reopened BETWEEN DATE_SUB(NOW(), INTERVAL 12 HOUR) AND NOW() AND staff_id = ?

    Get all tickets closed with the canned response of Ticket re-closed due to thank you message.
    SELECT COUNT(ost_ticket.ticket_id) FROM ost_ticket JOIN ost_department ON ost_ticket.dept_id = JOIN ost_thread ON ost_ticket.ticket_id = ost_thread.object_id JOIN ost_thread_entry ON = ost_thread_entry.thread_id WHERE ost_ticket.reopened BETWEEN DATE_SUB(NOW(), INTERVAL 12 HOUR) AND NOW() AND ost_thread_entry.body LIKE 'Ticket re-closed due to thank you message.'  and ost_ticket.staff_id = ?
  • For anybody who is interested i have attached the final PHP files i am using for basic external report.

  • Slight bug you will need to add the below red bit to calculate the total % closed correctly.

    //Compile Total Ticket Stats
    $message_body .= "<B><U>Statistics</B></U></br>";
    $message_body .= "Total Open: " . $TotalTicketsOpen . "</br>";
    $message_body .= "Total Closed: " . $TotalTicketsClosed . "</br>";
    $message_body .= "Total Overdue: " . $TotalTicketsOverdue . "</br>";

    //Calculate the total percentage closed
    $PercentClosed = $TotalTicketsClosed / $TotalTicketsOpen * 100;
    $PercentClosed = round($PercentClosed);
  • We use the ReportMod by forum member @scottro available at
  • Thanks ill take a look now
  • edited November 2017
    It looks like the website is now for a tattoo parlor, and the older website at is now defunct too.  Does anyone know how to fund the ReportMod plug in these days?

    Sorry, not sure what I was doing this morning, but the sites (both of them) appear to work fine!
  • Sorry about that. I had an issue during the move to a new host but it’s been resolved for a while now

Sign In or Register to comment.