From 3dae8885668d1a59887ed4df6653f8ec5936db4c Mon Sep 17 00:00:00 2001 From: Stephanie Buser Date: Tue, 13 Sep 2022 19:35:52 -0700 Subject: [PATCH] Unable to filter by float/fixed client (#2) * Unable to filter by float/fixed client Signed-off-by: Stephanie Buser --- cacti/plugins/grid/grid_clients.php | 46 ++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/cacti/plugins/grid/grid_clients.php b/cacti/plugins/grid/grid_clients.php index 3f348a81..f1846d58 100644 --- a/cacti/plugins/grid/grid_clients.php +++ b/cacti/plugins/grid/grid_clients.php @@ -32,19 +32,20 @@ bottom_footer(); function grid_view_get_clients_records(&$sql_where, $apply_limits = true, $rows, &$sql_params) { - /* user id sql where */ - if (get_request_var('clusterid') == '0') { - /* Show all items */ - } else { - $sql_where = 'WHERE (grid_clusters.clusterid = ?)'; + if (get_request_var('clusterid') > '0') { + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . 'grid_clusters.clusterid = ?'; $sql_params[] = get_request_var('clusterid'); } /* make sure we are looking at clients only */ - if ($sql_where != '') { - $sql_where .= " AND isServer='0'"; - } else { - $sql_where = "WHERE isServer='0'"; + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . " isServer = 0"; + + if (get_request_var('type') > 0) { + if (get_request_var('type') == 1) { + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . 'licFeaturesNeeded = 16'; + } else if (get_request_var('type') == 2) { + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . 'licFeaturesNeeded != 512'; + } } /* filter sql where */ @@ -92,6 +93,26 @@ function clientsFilter() { '> + + + + + + @@ -152,6 +173,10 @@ function grid_view_clients() { 'filter' => FILTER_VALIDATE_INT, 'default' => '1' ), + 'type' => array( + 'filter' => FILTER_VALIDATE_INT, + 'default' => '-1' + ), 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, @@ -198,7 +223,7 @@ function grid_view_clients() { ?>