#10976 fix bug search agents global search
This commit is contained in:
parent
5e7a3d96d4
commit
178f04945f
|
@ -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) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalAgents).'</a>';
|
||||
$table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $_SESSION['totalAgents']).'</a>';
|
||||
unset($_SESSION['totalAgents']);
|
||||
$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found'), 'class' => 'invert_filter']);
|
||||
$table->data[0][3] = "<a href='index.php?search_category=modules&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalModules).'</a>';
|
||||
|
||||
|
|
Loading…
Reference in New Issue