Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ticket_assigned_to filter in SQL query #840

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tickets.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php


// Default Column Sortby Filter
$sort = "ticket_number";
$order = "DESC";
Expand Down Expand Up @@ -36,9 +37,9 @@
// Ticket assignment status filter
if (isset($_GET['assigned']) & !empty($_GET['assigned'])) {
if ($_GET['assigned'] == 'unassigned') {
$ticket_assigned_filter = '0';
$ticket_assigned_filter = 'AND ticket_assigned_to = 0';
} else {
$ticket_assigned_filter = intval($_GET['assigned']);
$ticket_assigned_filter = 'AND ticket_assigned_to = '.intval($_GET['assigned']);
}
} else {
// Default - any
Expand All @@ -58,8 +59,7 @@
LEFT JOIN assets ON ticket_asset_id = asset_id
LEFT JOIN locations ON ticket_location_id = location_id
LEFT JOIN vendors ON ticket_vendor_id = vendor_id
WHERE ticket_assigned_to LIKE '%$ticket_assigned_filter%'
AND $ticket_status_snippet
WHERE $ticket_status_snippet " . $ticket_assigned_filter . "
AND DATE(ticket_created_at) BETWEEN '$dtf' AND '$dtt'
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_status LIKE '%$q%' OR ticket_priority LIKE '%$q%' OR user_name LIKE '%$q%' OR contact_name LIKE '%$q%' OR asset_name LIKE '%$q%' OR vendor_name LIKE '%$q%' OR ticket_vendor_ticket_number LIKE '%q%')
ORDER BY $sort $order LIMIT $record_from, $record_to"
Expand Down
Loading