diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index f0b981549c..15bfd0f279 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-12-13 Sergio Martin + + * include/functions_users.php: Change the get user groups + to return the groups orderer by name + 2011-12-13 Sergio Martin * include/functions_graph.php: Fixed a bug of the diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 83c77062d4..02c0061f4d 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -87,10 +87,10 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup $list_id_groups = array_unique($list_id_groups); - $groups = db_get_all_rows_filter('tgrupo', array('id_grupo' => $list_id_groups)); + $groups = db_get_all_rows_filter('tgrupo', array('id_grupo' => $list_id_groups, 'order' => 'parent, nombre')); } else { - $groups = db_get_all_rows_in_table ('tgrupo', 'nombre'); + $groups = db_get_all_rows_in_table ('tgrupo', 'parent, nombre'); } $user_groups = array (); @@ -100,13 +100,16 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup if ($returnAllGroup) { //All group if ($returnAllColumns) { - $groups[] = array('id_grupo' => 0, 'nombre' => __('All'), + $groupall = array('id_grupo' => 0, 'nombre' => __('All'), 'icon' => 'world', 'parent' => 0, 'disabled' => 0, 'custom_id' => null, 'propagate' => 0); } else { - $groups[] = array('id_grupo' => 0, 'nombre' => __("All")); + $groupall = array('id_grupo' => 0, 'nombre' => __("All")); } + + // Add the All group to the beginning to be always the first + array_unshift($groups, $groupall); } foreach ($groups as $group) { @@ -128,8 +131,6 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup } } - ksort($user_groups); - return $user_groups; }