2011-07-19 Sergio Martin <sergio.martin@artica.es>

* include/functions_networkmap.php
	include/functions_visual_map.php
	include/functions_agents.php: Fixed more errors when
	no agents for bug 3371316 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4587 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2011-07-19 14:29:59 +00:00
parent 13d4cd30b3
commit 700d6996dd
4 changed files with 33 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2011-07-19 Sergio Martin <sergio.martin@artica.es>
* include/functions_networkmap.php
include/functions_visual_map.php
include/functions_agents.php: Fixed more errors when
no agents for bug 3371316
2011-07-19 Sergio Martin <sergio.martin@artica.es> 2011-07-19 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php: Fixed check when no * include/functions_html.php: Fixed check when no

View File

@ -910,6 +910,11 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
if ($id_agent === null) { if ($id_agent === null) {
//Extract the agents of group user. //Extract the agents of group user.
$groups = users_get_groups(false, 'AR', false); $groups = users_get_groups(false, 'AR', false);
if(empty($groups)) {
return array();
}
$id_groups = array_keys($groups); $id_groups = array_keys($groups);
$sql = "SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")"; $sql = "SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")";
@ -925,6 +930,11 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
$id_agent = safe_int ($id_agent, 1); $id_agent = safe_int ($id_agent, 1);
$userGroups = users_get_groups($config['id_user'], 'AR', false); $userGroups = users_get_groups($config['id_user'], 'AR', false);
if(empty($userGroups)) {
return array();
}
$id_userGroups = array_keys($userGroups); $id_userGroups = array_keys($userGroups);
$where = " WHERE ( $where = " WHERE (
@ -951,7 +961,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
) )
) )
)"; )";
if (! empty ($id_agent)) { if (! empty ($id_agent)) {
$where .= sprintf (' AND id_agente IN (%s)', implode (",", (array) $id_agent)); $where .= sprintf (' AND id_agente IN (%s)', implode (",", (array) $id_agent));
} }

View File

@ -176,6 +176,9 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
} }
else { else {
$groups = db_get_all_rows_in_table ('tgrupo'); $groups = db_get_all_rows_in_table ('tgrupo');
if($groups === false) {
$groups = array();
}
} }
// Open Graph // Open Graph

View File

@ -1019,15 +1019,23 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
$filter = array (); $filter = array ();
$where = db_format_array_where_clause_sql ($filter); $where = db_format_array_where_clause_sql ($filter);
if ($where != '') {
$where .= ' AND ';
}
if ($returnAllGroup) if ($returnAllGroup)
$groups = users_get_groups ($id_user); $groups = users_get_groups ($id_user);
else else
$groups = users_get_groups ($id_user, 'IR', false); $groups = users_get_groups ($id_user, 'IR', false);
$where .= sprintf ('id_group IN (%s)', implode (",", array_keys ($groups)));
if(!empty($groups)) {
if ($where != '') {
$where .= ' AND ';
}
$where .= sprintf ('id_group IN (%s)', implode (",", array_keys ($groups)));
}
if($where == '') {
$where = array();
}
$layouts = db_get_all_rows_filter ('tlayout', $where); $layouts = db_get_all_rows_filter ('tlayout', $where);
if ($layouts == false) if ($layouts == false)