mirror of
https://github.com/itflow-org/itflow
synced 2026-08-05 07:07:14 +00:00
Response/resolution targets stamped at creation from per-client/priority assignments, business-hours due date math, warn/breach alert stages via cron/ticket_sla.php, ticket list coloring, per-ticket SLA override, admin page for plans/assignments/business hours. DB update 2.5.0. No behavior change unless SLAs are assigned. Bulk reply now only counts Public replies as first response.
49 lines
1.7 KiB
PHP
49 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");
|
|
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'; |