fixed secondary group in events

This commit is contained in:
Daniel Maya 2019-11-20 16:34:56 +01:00
parent 2469b65192
commit fad70cfdc0
2 changed files with 16 additions and 12 deletions

View File

@ -1042,6 +1042,8 @@ function events_get_all(
}
}
$user_admin_group_all = ($user_is_admin && $groups == 0) ? '' : 'tasg.';
// TAgs ACLS.
if (check_acl($config['id_user'], 0, 'ER')) {
$tags_acls_condition = tags_get_acl_tags(
@ -1066,7 +1068,7 @@ function events_get_all(
// Table tag for id_grupo.
'te.',
// Alt table tag for id_grupo.
'tasg.'
$user_admin_group_all
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EW')) {
@ -1092,7 +1094,7 @@ function events_get_all(
// Table tag for id_grupo.
'te.',
// Alt table tag for id_grupo.
'tasg.'
$user_admin_group_all
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EM')) {
@ -1118,7 +1120,7 @@ function events_get_all(
// Table tag for id_grupo.
'te.',
// Alt table tag for id_grupo.
'tasg.'
$user_admin_group_all
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
}
@ -1228,8 +1230,11 @@ function events_get_all(
}
// Secondary groups.
db_process_sql('SET group_concat_max_len = 9999999');
$event_lj = events_get_secondary_groups_left_join($table);
$event_lj = '';
if (!$user_is_admin || ($user_is_admin && isset($groups) && $groups > 0)) {
db_process_sql('SET group_concat_max_len = 9999999');
$event_lj = events_get_secondary_groups_left_join($table);
}
$group_selects = '';
if ($group_by != '') {

View File

@ -308,14 +308,13 @@ function groups_get_children($parent, $ignorePropagate=false)
static $groups;
if (empty($groups)) {
$aux_groups = [];
$groups = db_get_all_rows_in_table('tgrupo');
$groups = array_reduce(
$groups,
function ($carry, $item) {
$carry[$item['id_grupo']] = $item;
return $carry;
}
);
foreach ($groups as $key => $value) {
$aux_groups[$value['id_grupo']] = $value;
}
$groups = $aux_groups;
}
$return = [];