fix: unassigned filter not working + null guards on modal selects
- DashboardController: handle assigned_to='unassigned' before validateUserId() which discarded the string, causing the filter to never reach TicketModel; model already correctly converts 'unassigned' to IS NULL in SQL - dashboard.js: add null guards before .value access on dynamically-created modal selects (bulkPriority, bulkStatus, quickStatusSelect) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -136,10 +136,16 @@ class DashboardController {
|
||||
|
||||
// Validate user ID filters
|
||||
$createdBy = $this->validateUserId($_GET['created_by'] ?? null);
|
||||
$assignedTo = $this->validateUserId($_GET['assigned_to'] ?? null);
|
||||
|
||||
if ($createdBy !== null) $filters['created_by'] = $createdBy;
|
||||
if ($assignedTo !== null) $filters['assigned_to'] = $assignedTo;
|
||||
|
||||
// assigned_to accepts a numeric user ID or the special string 'unassigned'
|
||||
$assignedToRaw = $_GET['assigned_to'] ?? null;
|
||||
if ($assignedToRaw === 'unassigned') {
|
||||
$filters['assigned_to'] = 'unassigned';
|
||||
} else {
|
||||
$assignedTo = $this->validateUserId($assignedToRaw);
|
||||
if ($assignedTo !== null) $filters['assigned_to'] = $assignedTo;
|
||||
}
|
||||
|
||||
// Get tickets with pagination, sorting, search, and advanced filters
|
||||
$result = $this->ticketModel->getAllTickets($page, $limit, $status, $sortColumn, $sortDirection, $category, $type, $search, $filters, $GLOBALS['currentUser'] ?? []);
|
||||
|
||||
Reference in New Issue
Block a user