diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 6fd0cc84aa..63a264fee3 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -325,6 +325,13 @@ function agents_get_agents ($filter = false, $fields = false, $search = ''; } + if (isset($filter['search_custom'])) { + $search_custom = $filter['search_custom']; + unset($filter['search_custom']); + } else { + $search_custom = ''; + } + if (isset($filter['offset'])) { $offset = $filter['offset']; unset($filter['offset']); @@ -461,8 +468,8 @@ function agents_get_agents ($filter = false, $fields = false, $sql_extra, $where, $where_nogroup, $status_sql, $search, $disabled); } else { - $where = sprintf('%s AND %s AND (%s) %s AND %s', - $where, $where_nogroup, $status_sql, $search, $disabled); + $where = sprintf('%s AND %s AND (%s) %s AND %s %s', + $where, $where_nogroup, $status_sql, $search, $disabled, $search_custom); } $sql = sprintf('SELECT %s FROM tagente @@ -1310,6 +1317,24 @@ function agents_get_agent_id ($agent_name, $io_safe_input = false) { return (int) db_get_value ('id_agente', 'tagente', 'nombre', $agent_name); } +/** + * Get agents id from an agent alias. + * + * @param string $agent_alias Agent alias to get its id. + * @param boolean $io_safe_input If it is true transform to safe string, by default false. + * + * @return int Id from the agent of the given alias. + */ +function agents_get_agent_id_by_alias ($alias, $io_safe_input = false) { + if ($io_safe_input) { + $alias = io_safe_input($alias); + } + $sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$alias); + $agent_id = db_get_all_rows_sql($sql); + + return $agent_id; +} + /** * Get name of an agent. * diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index a458e308b3..fac79d3e0b 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -141,6 +141,7 @@ ob_end_clean(); // Take some parameters (GET) $group_id = (int) get_parameter ("group_id", 0); $search = trim(get_parameter ("search", "")); +$search_custom = trim(get_parameter ("search_custom", "")); $offset = (int)get_parameter('offset', 0); $refr = get_parameter('refr', 0); $recursion = get_parameter('recursion', 0); @@ -205,7 +206,7 @@ html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit echo '