[Tags performance] Fixed select_modules_for_agent_group function (failed with several secondary groups).
This commit is contained in:
parent
a72b9b0515
commit
d2b8939804
pandora_console/include
|
@ -2473,7 +2473,7 @@ function select_modules_for_agent_group(
|
||||||
$id_group, $id_agents, $selection, $return = true
|
$id_group, $id_agents, $selection, $return = true
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
$agents = implode(",", $id_agents);
|
$agents = (empty($id_agents)) ? array() : implode(",", $id_agents);
|
||||||
|
|
||||||
$filter_agent_group = "";
|
$filter_agent_group = "";
|
||||||
$filter_group = "";
|
$filter_group = "";
|
||||||
|
@ -2499,7 +2499,7 @@ function select_modules_for_agent_group(
|
||||||
}
|
}
|
||||||
if (!$selection && $agents != null) {
|
if (!$selection && $agents != null) {
|
||||||
$number_agents = count($id_agents);
|
$number_agents = count($id_agents);
|
||||||
$selection_filter = "HAVING COUNT(tagente_modulo.id_agente_modulo) = $number_agents";
|
$selection_filter = "HAVING COUNT(id_agente_modulo) = $number_agents";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tags_has_user_acl_tags(false)){
|
if (tags_has_user_acl_tags(false)){
|
||||||
|
@ -2511,20 +2511,23 @@ function select_modules_for_agent_group(
|
||||||
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo";
|
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.nombre
|
$sql = "SELECT * FROM
|
||||||
FROM tagente_modulo
|
(
|
||||||
$sql_tags_inner
|
SELECT DISTINCT(tagente_modulo.id_agente_modulo), tagente_modulo.nombre
|
||||||
INNER JOIN tagente
|
FROM tagente_modulo
|
||||||
ON tagente.id_agente = tagente_modulo.id_agente
|
$sql_tags_inner
|
||||||
LEFT JOIN tagent_secondary_group tasg
|
INNER JOIN tagente
|
||||||
ON tagente.id_agente = tasg.id_agent
|
ON tagente.id_agente = tagente_modulo.id_agente
|
||||||
WHERE tagente.disabled = 0
|
LEFT JOIN tagent_secondary_group tasg
|
||||||
AND tagente_modulo.disabled = 0
|
ON tagente.id_agente = tasg.id_agent
|
||||||
$filter_agent_group
|
WHERE tagente.disabled = 0
|
||||||
$filter_group
|
AND tagente_modulo.disabled = 0
|
||||||
$filter_agent
|
$filter_agent_group
|
||||||
$sql_conditions_tags
|
$filter_group
|
||||||
GROUP BY tagente_modulo.nombre
|
$filter_agent
|
||||||
|
$sql_conditions_tags
|
||||||
|
) x
|
||||||
|
GROUP BY nombre
|
||||||
$selection_filter";
|
$selection_filter";
|
||||||
|
|
||||||
$modules = db_get_all_rows_sql($sql);
|
$modules = db_get_all_rows_sql($sql);
|
||||||
|
|
Loading…
Reference in New Issue