From e56823516f73cc2298955da4072e194d6a1e03cb Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 9 Oct 2013 14:01:11 +0000 Subject: [PATCH] Mark tickets overdue which have no SLA If a ticket has a due date and does not have an SLA set, the ticket would never transition to overdue. This patch addresses an SQL flaw preventing the ticket from being transitioned. Fixes #757 --- include/class.ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class.ticket.php b/include/class.ticket.php index 294291f65..b8c8b38e0 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2166,7 +2166,7 @@ class Ticket { function checkOverdue() { $sql='SELECT ticket_id FROM '.TICKET_TABLE.' T1 ' - .' INNER JOIN '.SLA_TABLE.' T2 ON (T1.sla_id=T2.id AND T2.isactive=1) ' + .' LEFT JOIN '.SLA_TABLE.' T2 ON (T1.sla_id=T2.id AND T2.isactive=1) ' .' WHERE status=\'open\' AND isoverdue=0 ' .' AND ((reopened is NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),T1.created))>=T2.grace_period*3600) ' .' OR (reopened is NOT NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),reopened))>=T2.grace_period*3600) ' -- GitLab