From 3aa26226e5ea1968ae36fe8c52a1bb2dc5113a3c Mon Sep 17 00:00:00 2001 From: Hugo Sampaio Date: Wed, 29 Jan 2025 11:08:42 -0300 Subject: [PATCH] kanban post actions --- post/user/ticket_kanban.php | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 post/user/ticket_kanban.php diff --git a/post/user/ticket_kanban.php b/post/user/ticket_kanban.php new file mode 100644 index 00000000..a591ae16 --- /dev/null +++ b/post/user/ticket_kanban.php @@ -0,0 +1,51 @@ + 'success']); + exit; +} + +if (isset($_POST['update_kanban_ticket'])) { + // Update ticket kanban order and status + enforceUserPermission('module_support', 2); + + $positions = $_POST['positions']; + + foreach ($positions as $position) { + $ticket_id = intval($position['ticket_id']); + $kanban = intval($position['ticket_kanban']); // ticket kanban position + $status = intval($position['ticket_status']); // ticket statuses + + // Exit if status is null + if ($status === null) { + //echo json_encode(['status' => 'error', 'message' => 'Ticket status is null']); + continue; + } + + mysqli_query($mysqli, "UPDATE tickets SET ticket_kanban = $kanban, ticket_status = $status WHERE ticket_id = $ticket_id"); + customAction('ticket_update', $ticket_id); + } + + // return a response + echo json_encode(['status' => 'success','payload' => $positions]); + exit; +}