minor fixes in report item

This commit is contained in:
alejandro.campos@artica.es 2021-06-03 12:04:25 +02:00
parent 36eb084824
commit b8c6922902
2 changed files with 23 additions and 5 deletions

View File

@ -3139,6 +3139,10 @@ $class = 'databox filters';
</td> </td>
<td> <td>
<?php <?php
if ($selected_agent_os_filter === null) {
$selected_agent_os_filter = 0;
}
html_print_select_from_sql( html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os', 'SELECT id_os, name FROM tconfig_os',
'agent_os_filter[]', 'agent_os_filter[]',
@ -3193,6 +3197,10 @@ $class = 'databox filters';
$fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $fields[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$fields[AGENT_STATUS_NOT_INIT] = __('Not init'); $fields[AGENT_STATUS_NOT_INIT] = __('Not init');
if ($selected_agent_status_filter === null) {
$selected_agent_status_filter = -1;
}
html_print_select( html_print_select(
$fields, $fields,
'agent_status_filter[]', 'agent_status_filter[]',
@ -3239,7 +3247,7 @@ $class = 'databox filters';
<td class="bolder"> <td class="bolder">
<?php <?php
echo __('Agent has remote configuration').ui_print_help_tip( echo __('Agent has remote configuration').ui_print_help_tip(
__('Filter by agents by remote configuration enabled or disabled.'), __('Filter agents by remote configuration enabled.'),
true true
); );
?> ?>

View File

@ -2310,7 +2310,7 @@ function reporting_agents_inventory($report, $content)
} }
if ($es_agent_group_filter != 0) { if ($es_agent_group_filter != 0) {
$search_sql .= ' AND tagente.id_grupo = '.$es_agent_group_filter; $search_sql .= ' AND (tagente.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')';
} }
if ($es_agent_remote_conf != 0) { if ($es_agent_remote_conf != 0) {
@ -2331,7 +2331,7 @@ function reporting_agents_inventory($report, $content)
tagente.remote tagente.remote
FROM tagente LEFT JOIN tagent_secondary_group tasg FROM tagente LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent ON tagente.id_agente = tasg.id_agent
INNER JOIN tagente_modulo tam LEFT JOIN tagente_modulo tam
ON tam.id_agente = tagente.id_agente ON tam.id_agente = tagente.id_agente
WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s)) WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
%s', %s',
@ -2346,7 +2346,7 @@ function reporting_agents_inventory($report, $content)
$servers_ids = [0]; $servers_ids = [0];
} }
$return['data'] = []; $return_data = [];
foreach ($servers_ids as $server_id) { foreach ($servers_ids as $server_id) {
if (is_metaconsole()) { if (is_metaconsole()) {
@ -2412,13 +2412,23 @@ function reporting_agents_inventory($report, $content)
} }
} }
$return['data'] = array_merge($return['data'], $agents); $return_data[$server_id] = $agents;
if (is_metaconsole()) { if (is_metaconsole()) {
metaconsole_restore_db(); metaconsole_restore_db();
} }
} }
$all_data = [];
foreach ($return_data as $server_agents) {
foreach ($server_agents as $agent) {
$all_data[] = $agent;
}
}
$return['data'] = $all_data;
return reporting_check_structure_content($return); return reporting_check_structure_content($return);
} }