mirror of
https://github.com/itflow-org/itflow
synced 2026-08-18 13:35:12 +00:00
Repair SLA verdicts missed by kanban/portal resolve; record first response on kanban resolve
This commit is contained in:
32
admin/database_updates/2.5.2.php
Normal file
32
admin/database_updates/2.5.2.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ITFlow - Database update to version 2.5.2 (from 2.5.1)
|
||||||
|
* Included by admin/database_updates.php - do not access directly
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||||
|
|
||||||
|
// Resolving a ticket from the kanban board or the client portal recorded
|
||||||
|
// the resolution timestamp but never judged the resolution SLA, so those
|
||||||
|
// tickets carry a target, a resolution time and no verdict. They read as
|
||||||
|
// still-in-flight and are left out of SLA reporting entirely.
|
||||||
|
//
|
||||||
|
// Both timestamps were stored, so the verdict is simply recomputed from
|
||||||
|
// them. Only rows with no verdict at all are touched - anything already
|
||||||
|
// judged keeps the answer it was given at the time.
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets
|
||||||
|
SET ticket_resolution_sla_met = (ticket_resolved_at <= ticket_resolution_due_at)
|
||||||
|
WHERE ticket_sla_id > 0
|
||||||
|
AND ticket_resolution_due_at IS NOT NULL
|
||||||
|
AND ticket_resolved_at IS NOT NULL
|
||||||
|
AND ticket_resolution_sla_met IS NULL");
|
||||||
|
|
||||||
|
// Same repair on the response track, for any ticket whose first response
|
||||||
|
// was recorded without the verdict being written alongside it
|
||||||
|
mysqli_query($mysqli, "UPDATE tickets
|
||||||
|
SET ticket_response_sla_met = (ticket_first_response_at <= ticket_response_due_at)
|
||||||
|
WHERE ticket_sla_id > 0
|
||||||
|
AND ticket_response_due_at IS NOT NULL
|
||||||
|
AND ticket_first_response_at IS NOT NULL
|
||||||
|
AND ticket_response_sla_met IS NULL");
|
||||||
@@ -508,6 +508,9 @@ if (isset($_POST['update_kanban_ticket'])) {
|
|||||||
} elseif ($status === $statuses['Resolved']) {
|
} elseif ($status === $statuses['Resolved']) {
|
||||||
// If the ticket was moved to a resolved status, we need to update ticket_resolved_at
|
// If the ticket was moved to a resolved status, we need to update ticket_resolved_at
|
||||||
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id");
|
mysqli_query($mysqli, "UPDATE tickets SET ticket_order = $kanban, ticket_status = $status, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id");
|
||||||
|
// An agent resolving the ticket counts as a response, same as
|
||||||
|
// resolving from the ticket itself does
|
||||||
|
setTicketFirstResponse($ticket_id);
|
||||||
setTicketResolutionSlaMet($ticket_id);
|
setTicketResolutionSlaMet($ticket_id);
|
||||||
syncTicketSlaClock($ticket_id);
|
syncTicketSlaClock($ticket_id);
|
||||||
triggerCustomAction('ticket_update', $ticket_id);
|
triggerCustomAction('ticket_update', $ticket_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user