Ticket SLA: Fix on hold to pause only after first reply, show resolved closed and onhold as fixed on paused sla in the list

This commit is contained in:
johnnyq
2026-08-15 19:55:40 -04:00
parent bcc73737e4
commit 6af0634f47
11 changed files with 142 additions and 15 deletions

View File

@@ -59,6 +59,35 @@ function getInvoiceBadgeColor($invoice_status) {
* The display name for a ticket status id, RAW. Escaping is the caller's job -
* same convention as getFieldById() above.
*/
/*
* Fixed SLA clock behaviour for the five built-in ticket statuses.
*
* New and Open always run the resolution clock; On Hold, Resolved and Closed
* always stop it, and none of the five can be configured otherwise. A ticket
* nobody can work on should not burn resolution budget, and a finished ticket
* has a verdict rather than a clock.
*
* Resolved and Closed additionally stop BOTH clocks through ticket_resolved_at
* and ticket_closed_at, which cron/ticket_sla.php and syncTicketSlaClock() read
* directly - their behaviour never depended on this flag and still does not.
* The flag is set on them so every SLA surface reads one consistent answer.
*
* Returns 1 or 0 for a built-in status, or null for a custom one (id > 5),
* which the admin configures freely.
*/
function getTicketStatusSlaLock($ticket_status_id)
{
$locked_statuses = [
1 => 0, // New
2 => 0, // Open
3 => 1, // On Hold
4 => 1, // Resolved
5 => 1, // Closed
];
return $locked_statuses[intval($ticket_status_id)] ?? null;
}
function getTicketStatusName($ticket_status) {
global $mysqli;