diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php
index 4b5cde917f..f58c2e6002 100644
--- a/pandora_console/operation/search_agents.getdata.php
+++ b/pandora_console/operation/search_agents.getdata.php
@@ -17,6 +17,7 @@ enterprise_include_once('include/functions_policies.php');
require_once $config['homedir'].'/include/functions_users.php';
$searchAgents = get_parameter('search_agents', 0);
+$stringSearchSQL = get_parameter('stringSearchSQL');
$order = get_datatable_order(true);
if (empty($order)) {
$order = [];
@@ -77,11 +78,11 @@ if ($searchAgents) {
$id = db_get_all_rows_sql($sql);
if ($id != '') {
$aux = $id[0]['id_agent'];
- $search_sql = " t1.nombre LIKE '%%cd ".$stringSearchSQL."%%' OR
+ $search_sql = " t1.nombre LIKE '%%".$stringSearchSQL."%%' OR
t2.nombre LIKE '%%".$stringSearchSQL."%%' OR
t1.alias LIKE '%%".$stringSearchSQL."%%' OR
t1.comentarios LIKE '%%".$stringSearchSQL."%%' OR
- t1.id_agente = $aux";
+ t1.id_agente =".$aux;
$idCount = count($id);
@@ -163,6 +164,7 @@ if ($searchAgents) {
$totalAgents = db_get_value_sql(
'SELECT COUNT(DISTINCT id_agente) AS agent_count '.$sql
);
+ $_SESSION['totalAgents'] = $totalAgents;
}
foreach ($agents as $key => $agent) {
diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php
index 01ea4a5509..5624a34c2c 100755
--- a/pandora_console/operation/search_agents.php
+++ b/pandora_console/operation/search_agents.php
@@ -54,7 +54,10 @@ try {
'columns' => $columns,
'column_names' => $column_names,
'ajax_url' => 'operation/search_agents.getdata',
- 'ajax_data' => ['search_agents' => 1],
+ 'ajax_data' => [
+ 'search_agents' => 1,
+ 'stringSearchSQL' => $stringSearchSQL,
+ ],
'order' => [
'field' => 'alias',
'direction' => 'asc',
diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php
index f3d91803fa..cd56b3bfbe 100644
--- a/pandora_console/operation/search_main.php
+++ b/pandora_console/operation/search_main.php
@@ -52,7 +52,8 @@ $table->style[15] = 'font-weight: bold; text-align: left;';
$table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found'), 'class' => 'invert_filter']);
-$table->data[0][1] = "".sprintf(__('%s Found'), $totalAgents).'';
+$table->data[0][1] = "".sprintf(__('%s Found'), $_SESSION['totalAgents']).'';
+unset($_SESSION['totalAgents']);
$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found'), 'class' => 'invert_filter']);
$table->data[0][3] = "".sprintf(__('%s Found'), $totalModules).'';