diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index c5312ed572..ba51431416 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -521,7 +521,9 @@ if ($search != '') { $search_sql .= ')'; } else { $search_sql = ' AND ( nombre '.$order_collation." - COLLATE utf8_general_ci LIKE '%$search%' OR alias ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%') "; + COLLATE utf8_general_ci LIKE '%$search%' + OR comentarios ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%' + OR alias ".$order_collation." COLLATE utf8_general_ci LIKE '%$search%') "; } } diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index c754628731..aad2835a36 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -20,6 +20,8 @@ $searchAgents = check_acl($config['id_user'], 0, 'AR'); $selectNameUp = ''; $selectNameDown = ''; +$selectDescriptionUp = ''; +$selectDescriptionDown = ''; $selectOsUp = ''; $selectOsDown = ''; $selectIntervalUp = ''; @@ -50,6 +52,26 @@ switch ($sortField) { } break; + case 'comentarios': + switch ($sort) { + case 'up': + $selectDescriptionUp = $selected; + $order = [ + 'field' => 'comentarios', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectDescriptionDown = $selected; + $order = [ + 'field' => 'comentarios', + 'order' => 'DESC', + ]; + break; + } + break; + case 'os': switch ($sort) { case 'up': @@ -133,6 +155,8 @@ switch ($sortField) { default: $selectNameUp = $selected; $selectNameDown = ''; + $selectDescriptionUp = ''; + $selectDescriptionDown = ''; $selectOsUp = ''; $selectOsDown = ''; $selectIntervalUp = ''; @@ -165,7 +189,8 @@ if ($searchAgents) { $aux = $id[0]['id_agent']; $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%cd ".$stringSearchSQL."%%' OR t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.id_agente = $aux"; if (count($id) >= 2) { @@ -177,7 +202,8 @@ if ($searchAgents) { } else { $search_sql = " t1.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t2.nombre COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR - t1.direccion COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.direccion COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR + t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.alias COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%'"; } @@ -211,7 +237,7 @@ if ($searchAgents) { ) '; - $select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet'; + $select = 'SELECT DISTINCT(t1.id_agente), t1.ultimo_contacto, t1.nombre, t1.comentarios, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet'; if ($only_count) { $limit = ' ORDER BY '.$order['field'].' '.$order['order'].' LIMIT '.$config['block_size'].' OFFSET 0'; } else { diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index 05383df31a..5dd83871eb 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -39,21 +39,23 @@ if (!$agents || !$searchAgents) { $table->head = []; if ($only_count) { $table->head[0] = __('Agent'); - $table->head[1] = __('OS'); - $table->head[2] = __('Interval'); - $table->head[3] = __('Group'); + $table->head[1] = __('Description'); + $table->head[2] = __('OS'); + $table->head[3] = __('Interval'); + $table->head[4] = __('Group'); } else { $table->head[0] = __('Agent').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).''; - $table->head[1] = __('OS').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).''; - $table->head[2] = __('Interval').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).''; - $table->head[3] = __('Group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).''; + $table->head[1] = __('Description').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).''; + $table->head[2] = __('OS').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectOsUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectOsDown]).''; + $table->head[3] = __('Interval').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectIntervalUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectIntervalDown]).''; + $table->head[4] = __('Group').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectGroupUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectGroupDown]).''; } - $table->head[4] = __('Modules'); - $table->head[5] = __('Status'); - $table->head[6] = __('Alerts'); - $table->head[7] = __('Last contact').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).''; - $table->head[8] = ''; + $table->head[5] = __('Modules'); + $table->head[6] = __('Status'); + $table->head[7] = __('Alerts'); + $table->head[8] = __('Last contact').' '.''.html_print_image('images/sort_up.png', true, ['style' => $selectLastContactUp]).''.''.html_print_image('images/sort_down.png', true, ['style' => $selectLastContactDown]).''; + $table->head[9] = ''; $table->align = []; $table->align[0] = 'left'; @@ -64,7 +66,8 @@ if (!$agents || !$searchAgents) { $table->align[5] = 'left'; $table->align[6] = 'left'; $table->align[7] = 'left'; - $table->align[8] = 'center'; + $table->align[8] = 'left'; + $table->align[9] = 'center'; $table->data = []; @@ -116,6 +119,7 @@ if (!$agents || !$searchAgents) { $table->data, [ $cellName, + ui_print_truncate_text($agent['comentarios'], 'comentarios', false, true, true, '[…]'), ui_print_os_icon($agent['id_os'], false, true), human_time_description_raw($agent['intervalo'], false, 'tiny'), ui_print_group_icon($agent['id_grupo'], true),