Merge branch '2219-Query_satura_base_de_datos_NT' into 'develop'

tags secondary groups patch

See merge request artica/pandorafms!1452
This commit is contained in:
vgilc 2018-04-26 15:11:43 +02:00
commit 830a2090fb
1 changed files with 25 additions and 7 deletions

View File

@ -733,7 +733,8 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
AND ttmc.id_tag IN (%s)',
is_array($group_tags) ? implode(',', $group_tags) : $group_tags);
}
// FIXME: Not properly way to increse performance
if(enterprise_hook('agents_is_using_secondary_groups')){
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
FROM tagente_modulo tamc
%s
@ -743,6 +744,17 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
ON tasg.id_agent = tac.id_agente
WHERE (tac.id_grupo = %d OR tasg.id_group = %d)',
$tag_join, $group_id, $group_id);
}
else{
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
FROM tagente_modulo tamc
%s
INNER JOIN tagente tac
ON tamc.id_agente = tac.id_agente
AND tac.id_grupo = %d',
$tag_join, $group_id);
}
$sql_condition = sprintf('(%sid_agente_modulo IN (%s))', $modules_table, $agent_condition);
$group_conditions[] = $sql_condition;
@ -859,8 +871,14 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
// Tags condition (The module has at least one of the restricted tags)
$tags_condition = '';
if (empty($group_tags)) {
// FIXME: Not properly way to increse performance
if(enterprise_hook('agents_is_using_secondary_groups')){
$tags_condition = "id_grupo = ".$group_id . " OR id_group = " . $group_id;
}
else{
$tags_condition = "id_grupo = ".$group_id;
}
}
else {
if (!is_array($group_tags)) {
$group_tags = explode(',', $group_tags);