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:
pobradovic08
2019-09-29 19:23:53 +02:00
committed by PipoCanaja
parent 43729d7b6f
commit 91ac7aff7f

View File

@@ -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]);
}