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

@@ -2865,7 +2865,8 @@ if (isExportRequest('export_tickets')) {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND COALESCE(ticket_status_pauses_sla, 0) = 0 AND (ticket_response_sla_alert_stage = 1 OR ticket_resolution_sla_alert_stage = 1)';
$filter_summary['SLA'] = 'SLA at risk';
} elseif ($sla_filter == 'paused') {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_status_pauses_sla = 1';
// Mirrors agent/tickets.php - finished tickets have a verdict, not a pause
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_status_pauses_sla = 1 AND ticket_resolved_at IS NULL AND ticket_closed_at IS NULL';
$filter_summary['SLA'] = 'SLA paused';
} elseif ($sla_filter == 'met') {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_response_sla_met = 1 AND (ticket_resolution_sla_met = 1 OR ticket_resolution_due_at IS NULL)';

View File

@@ -22,6 +22,9 @@ while ($row = mysqli_fetch_assoc($status_sql)) {
'name' => escapeHtml($row['ticket_status_name']),
'color' => escapeHtml($row['ticket_status_color']),
'pauses_sla' => intval($row['ticket_status_pauses_sla']),
// Resolved pauses the clock by finishing the ticket rather than parking it, so
// the header marker would be noise on that column (Closed is not a column here)
'show_sla_pause' => intval($row['ticket_status_pauses_sla']) && $status_id != 4,
'tickets' => array()
);
}
@@ -105,7 +108,7 @@ $kanban = array_values($statuses);
<div class="kanban-column-header" style="border-top-color: <?= $column['color'] ?>">
<span class="kanban-column-name"><?= $column['name'] ?></span>
<span class="badge rounded-pill bg-secondary ms-1"><?= count($column['tickets']) ?></span>
<?php if ($column['pauses_sla']) { ?>
<?php if ($column['show_sla_pause']) { ?>
<i class="fas fa-fw fa-pause text-secondary ms-1" title="The resolution SLA clock is paused in this status"></i>
<?php } ?>
</div>

View File

@@ -231,7 +231,9 @@ if ($tickets) {
// SLA alert stages are maintained by cron/ticket_sla.php (1 = warned, 2 = breached)
$ticket_sla_alert_stage = max(intval($row['ticket_response_sla_alert_stage']), intval($row['ticket_resolution_sla_alert_stage']));
$ticket_sla_paused = intval($row['ticket_status_pauses_sla']);
// Only an open ticket can be paused - Resolved and Closed pause the
// clock too, but what those tickets have is a verdict, not a pause
$ticket_sla_paused = $ticket_is_open && intval($row['ticket_status_pauses_sla']);
// A paused ticket isn't running down its clock, so drop the
// at-risk warning - a breach already recorded still stands
if ($ticket_sla_paused && $ticket_sla_alert_stage < 2) {

View File

@@ -199,7 +199,8 @@ if (!empty($_GET['sla']) && isset($sla_filter_labels[$_GET['sla']])) {
} elseif ($ticket_sla_filter == 'at_risk') {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND COALESCE(ticket_status_pauses_sla, 0) = 0 AND (ticket_response_sla_alert_stage = 1 OR ticket_resolution_sla_alert_stage = 1)';
} elseif ($ticket_sla_filter == 'paused') {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_status_pauses_sla = 1';
// Resolved and Closed pause the clock as well, but they are finished, not parked
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_status_pauses_sla = 1 AND ticket_resolved_at IS NULL AND ticket_closed_at IS NULL';
} elseif ($ticket_sla_filter == 'met') {
$ticket_sla_query = 'AND ticket_sla_id > 0 AND ticket_response_sla_met = 1 AND (ticket_resolution_sla_met = 1 OR ticket_resolution_due_at IS NULL)';
} elseif ($ticket_sla_filter == 'none') {