From 58cbb2fe484ff2ac63a3f40b3124dd0789b55925 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Wed, 25 Oct 2017 16:04:05 +0200 Subject: [PATCH] Add new fields to filter in search input text and operative selector filter - #1412 --- .../godmode/agentes/modificar_agente.php | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 3c5406c46c..ebf90ea11f 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -24,6 +24,7 @@ $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $recursion = (bool) get_parameter('recursion',false); $disabled = get_parameter('disabled', 0); +$os = get_parameter('os', 0); if ($ag_group == -1 ) $ag_group = (int) get_parameter ("ag_group", -1); @@ -163,6 +164,20 @@ html_print_select($fields,"disabled",$disabled,'this.form.submit()'); echo ""; +echo ""; +echo __('Operative System') . ' '; + +$pre_fields = db_get_all_rows_sql('select distinct(tagente.id_os),tconfig_os.description from tagente,tconfig_os where tagente.id_os = tconfig_os.id_os'); +$fields = array(); + +foreach ($pre_fields as $key => $value) { + $fields[$value['id_os']] = $value['description']; +} + +html_print_select($fields,"os",$os,'this.form.submit()','All',0); + +echo ""; + echo ""; echo __('Recursion') . ' '; html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()'); @@ -171,6 +186,8 @@ echo ""; echo __('Search') . ' '; html_print_input_text ("search", $search, '', 12); +echo ui_print_help_tip(__('Search filter by alias, name, description, IP address or custom fields content'), true); + echo ""; echo ""; echo ""; @@ -296,20 +313,26 @@ if ($search != "") { }else{ $search_sql = " AND ( nombre " . $order_collation . " LIKE LOWER('%$search%') OR alias " . $order_collation . " - LIKE LOWER('%$search%')) "; + LIKE LOWER('%$search%') OR comentarios " . $order_collation . " LIKE LOWER('%$search%') + OR EXISTS (SELECT * FROM tagent_custom_data + WHERE id_agent = id_agente AND description LIKE '%$search%'))"; } } if ($disabled == 1) { - $search_sql = " AND disabled = ". $disabled . $search_sql; + $search_sql .= " AND disabled = ". $disabled . $search_sql; } else { if ($disabled == 0) { - $search_sql = " AND disabled = 0" . $search_sql; + $search_sql .= " AND disabled = 0" . $search_sql; } } +if($os != 0){ + $search_sql .= " AND id_os = " . $os; +} + // Show only selected groups if ($ag_group > 0) {