SQLerror tasg reference

This commit is contained in:
fbsanchez 2019-06-24 18:52:38 +02:00
parent 0ed382c42c
commit 0ea8904e0a
2 changed files with 14 additions and 7 deletions

View File

@ -1075,7 +1075,9 @@ function events_get_all(
// Force_group_and_tag.
true,
// Table tag for id_grupo.
'te.'
'te.',
// Alt table tag for id_grupo.
'tasg.'
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
} else if (check_acl($config['id_user'], 0, 'EM')) {
@ -1099,7 +1101,9 @@ function events_get_all(
// Force_group_and_tag.
true,
// Table tag for id_grupo.
'te.'
'te.',
// Alt table tag for id_grupo.
'tasg.'
);
// FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)".
}

View File

@ -745,7 +745,8 @@ function tags_get_acl_tags(
$meta=false,
$childrens_ids=[],
$force_group_and_tag=false,
$id_grupo_table_pretag=''
$id_grupo_table_pretag='',
$alt_id_grupo_table_pretag=''
) {
global $config;
@ -820,7 +821,8 @@ function tags_get_acl_tags(
$meta,
$force_group_and_tag,
false,
$id_grupo_table_pretag
$id_grupo_table_pretag,
$alt_id_grupo_table_pretag
);
if (!empty($condition)) {
@ -917,7 +919,8 @@ function tags_get_acl_tags_event_condition(
$meta=false,
$force_group_and_tag=false,
$force_equal=false,
$id_grupo_table_pretag=''
$id_grupo_table_pretag='',
$alt_id_grupo_table_pretag=''
) {
global $config;
$condition = [];
@ -935,7 +938,7 @@ function tags_get_acl_tags_event_condition(
// Group condition (The module belongs to an agent of the group X)
// $group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));.
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR tasg.d_group = '.$group_id.')';
$group_condition = '('.$id_grupo_table_pretag.'id_grupo = '.$group_id.' OR '.$alt_id_grupo_table_pretag.'id_group = '.$group_id.')';
// Tags condition (The module has at least one of the restricted tags).
$tags_condition = '';
@ -971,7 +974,7 @@ function tags_get_acl_tags_event_condition(
}
$in_group = implode(',', $without_tags);
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR tasg.id_group IN (%s))', $in_group, $in_group);
$condition .= sprintf('('.$id_grupo_table_pretag.'id_grupo IN (%s) OR '.$alt_id_grupo_table_pretag.'id_group IN (%s))', $in_group, $in_group);
}
$condition = !empty($condition) ? "($condition)" : '';