diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b9d33b0d48..63d5fc6dd7 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-08-10 Miguel de Dios + + * include/functions_networkmap.php: fixed execution the generation when + it is empty. + 2011-08-10 Ramon Novoa * pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql: Added @@ -40,6 +45,11 @@ Fixes: #3371197 +2011-08-10 Miguel de Dios + + * include/functions_networkmap.php: fixed execution the generation when + it is empty. + 2011-08-10 Miguel de Dios * include/functions_menu.php, operation/menu.php, godmode/menu.php: fixed diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index d265e48652..3609ce94cc 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -48,14 +48,23 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_ $filter = array (); $filter['disabled'] = 0; - if ($group >= 1) + if ($group >= 1) { $filter['id_grupo'] = $group; - - // Get agent data - $agents = agents_get_agents ($filter, - array ('id_grupo, nombre, id_os, id_parent, id_agente')); + + $agents = agents_get_agents ($filter, + array ('id_grupo, nombre, id_os, id_parent, id_agente')); + } + else if ($group == -666) { + $agents = false; + } + else { + $agents = agents_get_agents ($filter, + array ('id_grupo, nombre, id_os, id_parent, id_agente')); + } + if ($agents === false) - return false; + //return false; + $agents = array(); // Open Graph $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); @@ -103,9 +112,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_ $node_count++; } - if (empty ($nodes)) { - return false; - } // Create nodes foreach ($nodes as $node_id => $node) { if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) { @@ -136,7 +142,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_ } // Create a central node if orphan nodes exist - if (count ($orphans)) { + if (count ($orphans) || empty ($nodes)) { $graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple); }