mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Update Admin posts to use new functions flash_alert and getFieldById which greatly cleans up and reduces the code also removed logging comments as implied by the function logAction
This commit is contained in:
@@ -11,10 +11,9 @@ if (isset($_POST['add_ticket_status'])) {
|
||||
|
||||
$ticket_status_id = mysqli_insert_id($mysqli);
|
||||
|
||||
// Logging
|
||||
logAction("Ticket Status", "Create", "$session_name created custom ticket status $name", 0, $ticket_status_id);
|
||||
|
||||
$_SESSION['alert_message'] = "Custom Ticket Status <strong>$name</strong> created";
|
||||
flash_alert("Custom Ticket Status <strong>$name</strong> created");
|
||||
|
||||
redirect();
|
||||
|
||||
@@ -30,10 +29,9 @@ if (isset($_POST['edit_ticket_status'])) {
|
||||
|
||||
mysqli_query($mysqli, "UPDATE ticket_statuses SET ticket_status_name = '$name', ticket_status_color = '$color', ticket_status_order = $order, ticket_status_active = $status WHERE ticket_status_id = $ticket_status_id");
|
||||
|
||||
// Logging
|
||||
logAction("Ticket Status", "Edit", "$session_name edited custom ticket status $name", 0, $ticket_status_id);
|
||||
|
||||
$_SESSION['alert_message'] = "Custom Ticket Status <strong>$name</strong> edited";
|
||||
flash_alert("Custom Ticket Status <strong>$name</strong> edited");
|
||||
|
||||
redirect();
|
||||
|
||||
@@ -49,18 +47,14 @@ if (isset($_GET['delete_ticket_status'])) {
|
||||
exit("Can't delete built-in statuses");
|
||||
}
|
||||
|
||||
// Get ticket status name for logging and notification
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM ticket_statuses WHERE ticket_status_id = $ticket_status_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$ticket_status_name = sanitizeInput($row['ticket_status_name']);
|
||||
$ticlet_status_name = sanitizeInput(getFieldById('ticket_statuses', $ticket_status_id, 'ticket_status_name'));
|
||||
|
||||
mysqli_query($mysqli, "DELETE FROM ticket_statuses WHERE ticket_status_id = $ticket_status_id");
|
||||
|
||||
// Logging
|
||||
logAction("Ticket Status", "Delete", "$session_name deleted custom ticket status $ticket_status_name");
|
||||
|
||||
$_SESSION['alert_type'] = "error";
|
||||
$_SESSION['alert_message'] = "Custom Ticket Status <strong>$ticket_status_name</strong> Deleted";
|
||||
flash_alert("Custom Ticket Status <strong>$ticket_status_name</strong> Deleted", 'error');
|
||||
|
||||
redirect();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user