From 482ec7efb73b4ff3fafcdab97ba761fb3b729bfa Mon Sep 17 00:00:00 2001 From: Ian Berry Date: Thu, 27 Mar 2003 03:57:51 +0000 Subject: [PATCH] updated filter code to reflect the host_id column git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@784 860744bd-22fc-0310-8c96-e9fe5004b5ca --- graph_view.php | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/graph_view.php b/graph_view.php index 11024d8d9..6119f36ff 100644 --- a/graph_view.php +++ b/graph_view.php @@ -165,27 +165,15 @@ case 'preview': } } - if (empty($_REQUEST["host_id"])) { - $sql_base = "from graph_templates_graph - $sql_join - $sql_where - " . (empty($sql_where) ? "where" : "and") . " graph_templates_graph.local_graph_id > 0 - and graph_templates_graph.title like '%%" . $_REQUEST["filter"] . "%%' - $sql_or"; - }else{ - $sql_base = "from graph_templates_graph - left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id - left join graph_local on graph_templates_graph.local_graph_id=graph_local.id - left join graph_templates_item on graph_local.id=graph_templates_item.local_graph_id - left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id - left join data_local on data_template_rrd.local_data_id=data_local.id - $sql_join - $sql_where - " . (empty($sql_where) ? "where" : "and") . " data_local.host_id=" . $_REQUEST["host_id"] . " - and graph_templates_graph.local_graph_id>0 - and graph_templates_graph.title like '%%" . $_REQUEST["filter"] . "%%' - group by graph_templates_graph.id"; - } + + $sql_base = "from graph_templates_graph + $sql_join + left join graph_local on graph_templates_graph.local_graph_id=graph_local.id + $sql_where + " . (empty($sql_where) ? "where" : "and") . " graph_templates_graph.local_graph_id > 0 + and graph_templates_graph.title like '%%" . $_REQUEST["filter"] . "%%' + " . (empty($_REQUEST["host_id"]) ? "" : " and graph_local.host_id=" . $_REQUEST["host_id"]) . " + $sql_or"; $total_rows = count(db_fetch_assoc("select graph_templates_graph.local_graph_id