From 91ac7aff7fb6e8f6f2cb3c34649922d9e62b14c9 Mon Sep 17 00:00:00 2001 From: pobradovic08 Date: Sun, 29 Sep 2019 19:23:53 +0200 Subject: [PATCH] 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. --- LibreNMS/Component.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LibreNMS/Component.php b/LibreNMS/Component.php index cb93a61d4e..d847ab33eb 100644 --- a/LibreNMS/Component.php +++ b/LibreNMS/Component.php @@ -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]); }