Changed name by alias in event list

This commit is contained in:
Daniel Maya 2017-03-02 12:48:40 +01:00
parent 2ec84d8c61
commit 3666ab9745
3 changed files with 19 additions and 9 deletions

View File

@ -121,9 +121,12 @@ if ($severity != -1) {
// In metaconsole mode the agent search is performed by name
if ($meta) {
if (($text_agent != __('All')) && ($text_agent !== '')) {
$text_agent = get_parameter("text_agent","");
$id_agent = get_parameter('id_agent',0);
if($id_agent){
$sql_post .= " AND agent_name IN (SELECT nombre FROM tmetaconsole_agent WHERE
id_tagente =".$id_agent." AND alias LIKE '".io_safe_input($text_agent)."')";
$filter_resume['agent'] = $text_agent;
$sql_post .= " AND agent_name LIKE '%$text_agent%'";
}
}
else {

View File

@ -271,6 +271,10 @@ else {
$show_validate_button = false;
$idx = 0;
if($meta){
$alias_array = array();
}
//Arrange data. We already did ACL's in the query
foreach ($result as $event) {
$data = array ();
@ -427,12 +431,17 @@ else {
if ($event["id_agente"] > 0) {
// Agent name
if ($meta) {
if(!empty($event["agent_name"])){
if(!array_key_exists($event["agent_name"],$alias_array)){
$alias_array [$event["agent_name"]] = db_get_value("alias","tmetaconsole_agent","nombre",$event["agent_name"]);
}
}
$agent_link = '<a href="'.$event["server_url"].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $event["id_agente"] . $event["server_url_hash"] . '">';
if (can_user_access_node ()) {
$data[$i] = '<b>' . $agent_link . $event["agent_name"] . '</a></b>';
$data[$i] = '<b>' . $agent_link . $alias_array [$event["agent_name"]] . '</a></b>';
}
else {
$data[$i] = $event["agent_name"];
$data[$i] = $alias_array [$event["agent_name"]] ;
}
}
else {

View File

@ -417,11 +417,9 @@ $params['return'] = true;
if ($meta) {
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
}
else {
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
$params['hidden_input_idagent_value'] = $id_agent;
}
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
$params['hidden_input_idagent_value'] = $id_agent;
$data[1] .= ui_print_agent_autocomplete_input($params);
$table_advanced->data[] = $data;