Merge branch '2611-Cache_de_vista_de_arbol_y_vista_de_grupos' into 'develop'

fixed minor error no agents group view

See merge request artica/pandorafms!1740
This commit is contained in:
vgilc 2018-09-10 12:43:26 +02:00
commit f0e1d61f6d
2 changed files with 8 additions and 4 deletions

View File

@ -278,7 +278,7 @@ class Tree {
: " AND $filter ";
}
static function getGroupAclCondition() {
public function getGroupAclCondition() {
if (users_can_manage_group_all("AR")) return "";
$groups_str= implode(",", $this->userGroupsArray);

View File

@ -34,6 +34,10 @@ function groupview_plain_groups($groups) {
}
function groupview_get_modules_counters($groups_ids = false) {
if(empty($groups_ids)){
return array();
}
$groups_ids = implode(',', $groups_ids);
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
$table_sec = is_metaconsole()
@ -83,9 +87,9 @@ function groupview_get_modules_counters($groups_ids = false) {
return db_get_all_rows_sql($sql);
}
function groupview_get_all_counters() {
function groupview_get_all_counters($tree_group) {
$all_name = __("All");
$group_acl = Tree::getGroupAclCondition();
$group_acl = $tree_group->getGroupAclCondition();
$table = is_metaconsole() ? 'tmetaconsole_agent' : 'tagente';
$table_sec = is_metaconsole()
? 'tmetaconsole_agent_secondary_group'
@ -176,7 +180,7 @@ function groupview_get_groups_list($id_user = false, $access = 'AR', $is_not_pag
$list[$id_group]['_monitors_alerts_fired_'] = (int)$modules_counters[$id_group]['total_module_alerts'];
}
array_unshift($list, groupview_get_all_counters());
array_unshift($list, groupview_get_all_counters($tree_group));
return array(
'groups' => $list,
'counter' => $counter