Fix Ticket Priority Sorting, now sorts by prioty when clicked

This commit is contained in:
johnnyq
2025-02-12 18:45:05 -05:00
parent fe762ef926
commit b8d17be015
4 changed files with 52 additions and 4 deletions

View File

@@ -25,7 +25,19 @@ $sql = mysqli_query(
LEFT JOIN clients on scheduled_ticket_client_id = client_id
WHERE scheduled_tickets.scheduled_ticket_subject LIKE '%$q%'
$rec_ticket_permission_snippet
ORDER BY $sort $order LIMIT $record_from, $record_to"
ORDER BY
CASE
WHEN '$sort' = 'scheduled_ticket_priority' THEN
CASE ticket_priority
WHEN 'High' THEN 1
WHEN 'Medium' THEN 2
WHEN 'Low' THEN 3
ELSE 4 -- Optional: for unexpected priority values
END
ELSE NULL
END $order,
$sort $order -- Apply normal sorting by $sort and $order
LIMIT $record_from, $record_to"
);
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));