mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Removed ambiguity in Component filter query (#10638)
In case we try to filter the component by it's `id`, we ran into ambiguity issue because both `component` and `component_prefs` tables have column `id`. Fixed by filtering explicitly on `component` table.
This commit is contained in:
@@ -112,11 +112,11 @@ class Component
|
||||
// Only add valid fields to the query
|
||||
if (in_array($field, $validFields)) {
|
||||
if ($array[0] == 'LIKE') {
|
||||
$SQL .= "`".$field."` LIKE ? AND ";
|
||||
$SQL .= "`C`.`".$field."` LIKE ? AND ";
|
||||
$array[1] = "%".$array[1]."%";
|
||||
} else {
|
||||
// Equals operator is the default
|
||||
$SQL .= "`".$field."` = ? AND ";
|
||||
$SQL .= "`C`.`".$field."` = ? AND ";
|
||||
}
|
||||
array_push($PARAM, $array[1]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user