Hi,
We are looking to close resolved tickets after a set number of days and have followed tfruba's answer in this thread: http://osticket.com/forum/discussion/comment/113121/ to no avail.
As per the thread I've added the following into /include/class.ticket.php:
// Added MB 170317 function closeResolvedTickets() {
$sql='SELECT ticket_id FROM '.TICKET_TABLE.' WHERE status_id = 2 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:($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.'));
}
}
}
// Added MB 200317
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;
}
Which is step 2 + 3 in the thread and added at line 3670 onwards. The only changes to the code in the thread was the status ID to 2 (believe this is resolved - we had to do some digging in some other files to find this - very new to this) and change of a double quote to a single in the logActivity line. This has been added to class.cron.php inside the TicketMonitor() function:
Ticket:(); //Marks ticket as closed due long response waiting period Added MB200317
When we made the changes live this instantly killed OSTicket giving us an internal server 500 error. I commented on the original thread and it was suggested that the mod was made for an earlier version and also to check the server logs when it errors. I am very new to this so not sure if I need to look at PHP or IIS error logs.
Any help would be much appreciated.
IIS7.5, PHP 7.09, OSTicket v1.10