Now the parent groups without modules appear on the group view table

* pandora_console/operation/agentes/group_view.php: Added the parent_id
	to the groups array.

* pandora_console/include/functions_groups.php: Fixed the function
	"groups_get_childrens". Improvements on the function
	"groups_get_group_row".
This commit is contained in:
Alejandro Gallardo Escobar 2014-09-24 13:09:15 +02:00
parent 18fc35c558
commit ef31093b00
2 changed files with 15 additions and 3 deletions

View File

@ -250,7 +250,7 @@ function groups_get_childrens($parent, $groups = null, $onlyPropagate = false) {
if ($group['propagate'] || $onlyPropagate) {
if ($group['parent'] == $parent) {
$return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups);
$return = $return + array($group['id_grupo'] => $group) + groups_get_childrens($group['id_grupo'], $groups, $onlyPropagate);
}
}
@ -869,8 +869,19 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) {
// Get stats for this group
$data = reporting_get_group_stats($id_group);
if ($data["total_agents"] == 0)
return; // Skip empty groups
if ($data["total_agents"] == 0) {
if (!empty($group['childs'])) {
$group_childrens = groups_get_childrens($id_group, null, true);
$group_childrens_agents = groups_total_agents(array_keys($group_childrens));
if (empty($group_childrens_agents)) {
return; // Skip empty groups
}
}
else {
return; // Skip empty groups
}
}
// Calculate entire row color
if ($data["monitor_alerts_fired"] > 0) {

View File

@ -58,6 +58,7 @@ $groups_full = users_get_groups ($config['id_user'], "AR", true, true);
$groups = array();
foreach ($groups_full as $group) {
$groups[$group['id_grupo']]['name'] = $group['nombre'];
$groups[$group['id_grupo']]['parent'] = $group['parent'];
if ($group['id_grupo'] != 0) {
$groups[$group['parent']]['childs'][] = $group['id_grupo'];