mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
kanban post actions
This commit is contained in:
51
post/user/ticket_kanban.php
Normal file
51
post/user/ticket_kanban.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - GET/POST request handler for client tickets
|
||||
*/
|
||||
|
||||
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
|
||||
|
||||
if (isset($_POST['update_kanban_status_position'])) {
|
||||
// Update multiple ticket status kanban orders
|
||||
enforceUserPermission('module_support', 2);
|
||||
|
||||
$positions = $_POST['positions'];
|
||||
|
||||
foreach ($positions as $position) {
|
||||
$status_id = intval($position['status_id']);
|
||||
$kanban = intval($position['status_kanban']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_kanban = $kanban WHERE ticket_status_id = $status_id");
|
||||
}
|
||||
|
||||
// return a response
|
||||
echo json_encode(['status' => '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;
|
||||
}
|
||||
Reference in New Issue
Block a user