Fixed server-side sorting for user-related columns on dashboard: Problem: - Clicking "Created By" or "Assigned To" headers didn't sort - Columns were missing from $allowedColumns validation - Fell back to ticket_id sort, appearing random to users Solution: 1. Added 'created_by' and 'assigned_to' to $allowedColumns array 2. Smart sort expression mapping: - created_by → sorts by display_name/username (not user ID) - assigned_to → uses CASE to put unassigned at end, then sorts by name - Other columns → use table prefix (t.column_name) 3. Database-level NULL handling for assigned_to: - Uses CASE WHEN to sort unassigned tickets last - Regardless of ASC/DESC direction - Then alphabetically sorts assigned users Result: - A→Z: Alice, Bob, Charlie... Unassigned - Z→A: Zack, Yolanda, Xavier... Unassigned - Consistent grouping and predictable order Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
15 KiB
15 KiB