Fix group report metaconsole

This commit is contained in:
Calvo 2023-09-05 15:33:20 +02:00
parent c0fbfda25c
commit 33d5dc2e76
1 changed files with 5 additions and 11 deletions

View File

@ -2590,12 +2590,6 @@ function reporting_html_group_report($table, $item, $pdf=0)
}
}
if (is_metaconsole() && $item['server_name'] === '0') {
$table_agent = 'tmetaconsole_agent';
} else {
$table_agent = 'tagente';
}
$all_group_id = [];
$group_events = [];
$group_os = [];
@ -2638,13 +2632,13 @@ function reporting_html_group_report($table, $item, $pdf=0)
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN '.$table_agent.' as ta ON te.id_agente = ta.id_agente
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN '.$table_agent.' as ta ON ta.id_os = os.id_os GROUP by os.name'
INNER JOIN tagente as ta ON ta.id_os = os.id_os GROUP by os.name'
);
}
@ -2729,7 +2723,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
);
$childrens = db_get_all_rows_sql('SELECT id_grupo FROM tgrupo WHERE parent = '.$group_id);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM '.$table_agent.' where id_grupo = '.$group_id);
$total_agents = db_get_all_rows_sql('SELECT COUNT(id_agente) as total FROM tagente where id_grupo = '.$group_id);
if ($childrens !== false && (int) $total_agents[0]['total'] !== $item['data']['group_stats']['total_agents']) {
$array_group_id = [];
@ -2747,14 +2741,14 @@ function reporting_html_group_report($table, $item, $pdf=0)
$group_events = db_get_all_rows_sql(
'SELECT COUNT(te.id_evento) as count_events, ta.alias
FROM tevento as te
INNER JOIN '.$table_agent.' as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
INNER JOIN tagente as ta ON te.id_agente = ta.id_agente WHERE te.id_grupo IN ('.$explode_group_id.')
GROUP BY te.id_agente'
);
$group_os = db_get_all_rows_sql(
'SELECT COUNT(os.name) as count_os, os.name as name_os, ta.id_grupo
FROM tconfig_os as os
INNER JOIN '.$table_agent.' as ta ON ta.id_os = os.id_os
INNER JOIN tagente as ta ON ta.id_os = os.id_os
WHERE ta.id_grupo IN ('.$explode_group_id.') GROUP by os.name'
);
}