From d43cd0398e5a6696731acf10ade6d677ebc37ae2 Mon Sep 17 00:00:00 2001 From: wrongecho Date: Mon, 19 Aug 2024 21:45:03 +0100 Subject: [PATCH] Bugfix: Bulk close should actually be bulk resolve --- post/ticket.php | 11 ++++++----- temp_bulk_close_bugfix.php | 28 ++++++++++++++++++++++++++++ ticket_bulk_resolve_modal.php | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 temp_bulk_close_bugfix.php diff --git a/post/ticket.php b/post/ticket.php index 49dcf3a69..3d021344e 100644 --- a/post/ticket.php +++ b/post/ticket.php @@ -807,7 +807,7 @@ header("Location: " . $_SERVER["HTTP_REFERER"]); } -if (isset($_POST['bulk_close_tickets'])) { +if (isset($_POST['bulk_resolve_tickets'])) { // Role check validateTechRole(); @@ -836,15 +836,16 @@ $ticket_number = intval($row['ticket_number']); $ticket_subject = sanitizeInput($row['ticket_subject']); $current_ticket_priority = sanitizeInput($row['ticket_priority']); + $url_key = sanitizeInput($row['ticket_url_key']); $client_id = intval($row['ticket_client_id']); // Update ticket & insert reply - mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 5, ticket_closed_at = NOW() WHERE ticket_id = $ticket_id"); + mysqli_query($mysqli, "UPDATE tickets SET ticket_status = 4, ticket_resolved_at = NOW() WHERE ticket_id = $ticket_id"); mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$details', ticket_reply_type = '$ticket_reply_type', ticket_reply_time_worked = '00:01:00', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id"); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Close', log_description = '$session_name closed $ticket_prefix$ticket_number - $ticket_subject in a bulk action', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $ticket_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Ticket', log_action = 'Resolve', log_description = '$session_name resolved $ticket_prefix$ticket_number - $ticket_subject in a bulk action', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $ticket_id"); // Client notification email if (!empty($config_smtp_host) && $config_ticket_client_general_notifications == 1 && $private_note == 0) { @@ -875,8 +876,8 @@ $data = []; - $subject = "Ticket closed - [$ticket_prefix$ticket_number] - $ticket_subject | (do not reply)"; - $body = "Hello $contact_name,

Your ticket regarding \"$ticket_subject\" has been closed.

$details

We hope the request/issue was resolved to your satisfaction. If you need further assistance, please raise a new ticket using the below details. Please do not reply to this email.

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; + $subject = "Ticket resolved - [$ticket_prefix$ticket_number] - $ticket_subject | (pending closure)"; + $body = "##- Please type your reply above this line -##

Hello $contact_name,

Your ticket regarding \"$ticket_subject\" has been marked as solved and is pending closure.

$details

If your request/issue is resolved, you can simply ignore this email. If you need further assistance, please reply or re-open to let us know!

Ticket: $ticket_prefix$ticket_number
Subject: $ticket_subject
Portal: https://$base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; // Email Ticket Contact // Queue Mail diff --git a/temp_bulk_close_bugfix.php b/temp_bulk_close_bugfix.php new file mode 100644 index 000000000..6561ad10f --- /dev/null +++ b/temp_bulk_close_bugfix.php @@ -0,0 +1,28 @@ + + + + + + +

Temporary page to fix bulk ticket close/resolution bug

+
+

Navigate back to tickets - all bulk closed tickets should be fixed now and no longer appear as open.

+ + + +