From 0ea8904e0aa1b0af363eab041d2c76da5667e240 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 24 Jun 2019 18:52:38 +0200 Subject: [PATCH] SQLerror tasg reference --- pandora_console/include/functions_events.php | 8 ++++++-- pandora_console/include/functions_tags.php | 13 ++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 892cf22077..35529a941f 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -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)". } diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index c4ecc81277..aad6d78efd 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -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)" : '';