mirror of
https://github.com/itflow-org/itflow
synced 2026-08-05 23:27:17 +00:00
Statuses can be flagged to pause the resolution clock; sla_history records the intervals a ticket's clock actually ran and the deadline is re-based on remaining budget when it resumes. Adds SLA Summary and SLA by Client reports, an SLA state filter on the ticket list, SLA colouring on kanban cards, and an Urgent column on the Tickets by Client report. DB update 2.5.1. Also fixes resolution SLA verdicts being skipped when resolving via kanban or the client portal.
50 lines
1.7 KiB
PHP
50 lines
1.7 KiB
PHP
<?php
|
|
|
|
// Resolve endpoint for tickets
|
|
// Just send a POST here with a ticket & client id, and we do the rest
|
|
|
|
require_once '../validate_api_key.php';
|
|
|
|
require_once '../require_post_method.php';
|
|
|
|
// Parse Info
|
|
$ticket_id = intval($_POST['ticket_id']);
|
|
|
|
// Default
|
|
$update_count = false;
|
|
|
|
if (!empty($ticket_id)) {
|
|
|
|
$ticket_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = '$ticket_id' AND ticket_resolved_at IS NULL AND ticket_client_id = $client_id LIMIT 1"));
|
|
|
|
// Grab what we need, not using the model
|
|
$ticket_id = intval($ticket_row['ticket_id']); // Override so things fail if this is bad
|
|
$ticket_prefix = escapeSql($ticket_row['ticket_prefix']);
|
|
$ticket_number = intval($ticket_row['ticket_number']);
|
|
$ticket_first_response_at = escapeSql($ticket_row['ticket_first_response_at']);
|
|
|
|
// Mark FR (if not)
|
|
if (empty($ticket_first_response_at)) {
|
|
setTicketFirstResponse($ticket_id);
|
|
}
|
|
|
|
// Resolve
|
|
$update_sql = mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 4, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id AND ticket_client_id = $client_id LIMIT 1");
|
|
syncTicketSlaClock($ticket_id);
|
|
setTicketResolutionSlaMet($ticket_id);
|
|
|
|
// Check insert & get insert ID
|
|
if ($update_sql) {
|
|
$update_count = mysqli_affected_rows($mysqli);
|
|
|
|
// Logging
|
|
logAudit("Ticket", "Resolved", "$ticket_prefix$ticket_number ticket via API ($api_key_name)", $client_id, $ticket_id);
|
|
logAudit("API", "Success", "Resolved ticket $ticket_prefix$ticket_number via API ($api_key_name)", $client_id);
|
|
}
|
|
|
|
triggerCustomAction('ticket_resolve', $ticket_id);
|
|
|
|
}
|
|
|
|
// Output
|
|
require_once '../update_output.php'; |