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

Pending Ticket Status with auto-close

The system needs a pending status which can then be auto-closed by the system after a number of days of inactivity. This could be a really good plugin and could also be a fast and easy one for some that is familiar with plugins.
Tagged:

Comments

  • +1
    This has been suggested many times. :) 
    [hell I even wrote a mod to do it back in 1.6 and 1.7]
  • +1 even if I don't like the "auto close": if it's still pending after grace period, IMVHO it should return to fully open.

    Another useful state could be "pre-close": you set it on a ticket for which a possible solution have been given. If no problem arises in the grace period, then the ticket is closed. The current workflow is to close it and reopen if solution doesn't work, or delay closing it till solution is confirmed...
  • OSTicket 1.9.4 RC2 killed my pending ticket!!!!!!
  • Simply +1 :D
  • I'd love this - My proposed workflow would be to suggest a solution to the customer, mark the ticket as "Resolved" - if customer responds, ticket re-opens as normal.  If customer accepts solution in response, I can mark it as closed (or resolved again), but if the customer accepts by doing nothing, then I want that ticket to close after a grace period...maybe 30 days or so.  Closed tickets will be flagged as not able to be re-opened.

    I suppose that worst-case I could cron a script to just run SQL queries to do the deed in the background, but I don't know what other functionality I'd be cutting off by doing so.

    In a similar use case, I'd like the option to auto-close "abandoned" tickets - we respond to the customer with request for information and they never reply...if they don't get back to me in 30-60 days, I don't want the zombie ticket hanging around - just close it.

    If I could do it with a ticket filter, I would...but there doesn't really appear to be a way to do those more general "workflow" tasks.

    Sorry to resurrect an old thread...
  • @sstillwell 
    that sounds perfect!
  • Does anyone have an update on the "auto close" this is something that we need in our enviroment as well.
  • edited November 2016
    Hello,

    I've made some modifications in osTicket's code, so my unresponded mail's automagically closed after 7 days of inactivity, but hey! let's start from the beggining...

    First of all - I'm an administrator of a helpdesk system based on osTicket (originally). Now the code has been modified by me, that it doesn't even remind the old osTicket ;) The problem is that the company is quite small (~40 employees), but has a lot of customers and four persons from hepdesk department has to deal with hudge amount of tickets. In my case - tickets marked as 'waiting for response' couldn't been hanging together with opened tickets, cause it was causing one big hell of a mess.

    1. Status 'waiting for response'
    As I've said above - there was no space fo tickets with status 'waiting for response' hanging together with opened tickets. That's why I went to ticket statuses dictionary and I've create a status 'waiting for response' as substatus of 'closed'. That caused that the tickets marked with this status were moved to 'closed tickets'. And that was fine for about one month. After that I've realised that I haven't cleaned up this mess, but I've only moved it somewhere else. That caused the need of create auto-cron for cleaning up this mess, so I've decided to do the job basing on 'mark as overdue' mechanism.

    2. Main function.
    If we'll go to /include/class.cron.php file - we'll see a function 'TicketMonitor()' which calls function 'checkOverdue()' in Ticket class. So I've opened up file /include/class.ticket.php and found 'checkOverdue()' function. It's just a simple SQL query that fetches tickets ids and are older than some time defined in SLA table.
    What I've done was just to copy and paste this function with different name, right under 'checkOverdue()' function:

    function checkResponseRequested() {
    $sql='SELECT ticket_id FROM '.TICKET_TABLE.' WHERE status_id = 8 AND DATEDIFF(now(), updated) > 7 LIMIT 50';
    if(($res=db_query($sql)) && db_num_rows($res)) {
    while(list($id)=db_fetch_row($res)) {
    if($ticket=Ticket::lookup($id)) && $ticket->markClosedWithoutResponse())
    $ticket->logActivity(_S('Ticket closed due to response timeout'), _S("Ticket has been closed by the system as nobody has responded in 7 days.'));
    }
    }
    }

    Don't forget to replace the status ID with your own ID and no. of days as well.

    3. Dependant function
    As the original function 'checkOverdue()' marks overdue tickets using 'markOverdue()' function - I've copied that function as well and named it as shown above - 'markClosedWithoutResponse()'.

    function markClosedWithoutResponse() {
    global $cfg;

    $sql='UPDATE '.TICKET_TABLE.' SET status_id=3, closed=NOW() '
    .' WHERE ticket_id='.db_input($this->getId());

    if(!db_query($sql) || !db_affected_rows())
    return false;

    $this->logEvent('closed');

    return true;
    }

    4. Back to the beginning.
    The last thing to do that has left is to run the function with function, so we need to go back to /include/class.cron.php file add the following line, right behind the one that checks overdue tickets:

    Ticket::checkResponseRequested(); //Marks ticket as closed due long response waiting period


    And that would be all I think. If you'd have any further questions - feel free to contact me.
  • We are trying to use tfruba's answer to close resolved tickets that have not had a response after 7 days. We pretty much copied and pasted the code only changing the ID (to 2 as this is resolved) and renamed the markclosedwithoutresponse function to closeresolvedtickets. Only other change was in the line:

    $ticket->logActivity(_S('Ticket closed due to response timeout'), _S("Ticket has been closed by the system as nobody has responded in 7 days.'));

    The double quote at the beginning of the second comment was changed to a single quote.

    Unfortunately once live the code completely killed osticket for us and gave an internal 500 error. Can anyone help?

  • tfruba's does not mention what version of OS-Ticket his changes are on,  so it might be that the versions are different.

    Did you check the error log for your server when you got the error?


  • tfruba's post came 6 days after 1.10 was released... but the thread originated in June 2014. 1.9.2 and 1.8..4 was released on Jun 19.  So it's likely this thread was started for version 1.9.1.

    Also this is a Feedback and Suggestion thread... not a Mods and Customization thread. 

    I'm going to close this ancient thread.  Especially since the replies seem to indicate that this doesn't work.
This discussion has been closed.