Merge branch 'ent-9473-derivado-del-trabajo-q-a-765-api-pfms-get-total_modules-no-devuelve-total-por-grupo-especifico' into 'develop'
Ent 9473 derivado del trabajo q a 765 api pfms get total modules no devuelve total por grupo especifico https://brutus.artica.es:8081/artica/pandora_enterprise/-/issues/9473 See merge request artica/pandorafms!5419
This commit is contained in:
commit
c15fe41897
|
@ -12471,9 +12471,26 @@ function api_get_total_modules($id_group, $trash1, $trash2, $returnType)
|
|||
return;
|
||||
}
|
||||
|
||||
$partial = tactical_status_modules_agents($config['id_user'], false, 'AR');
|
||||
if ($id_group) {
|
||||
$groups_clause = '1 = 1';
|
||||
if (!users_is_admin($config['id_user'])) {
|
||||
$user_groups = implode(',', array_keys(users_get_groups()));
|
||||
$groups_clause = "(ta.id_grupo IN ($user_groups) OR tasg.id_group IN ($user_groups))";
|
||||
}
|
||||
|
||||
$total = (int) $partial['_monitor_total_'];
|
||||
$sql = "SELECT COUNT(DISTINCT(id_agente_modulo))
|
||||
FROM tagente_modulo tam, tagente ta
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE tam.id_agente = ta.id_agente AND id_module_group = $id_group
|
||||
AND delete_pending = 0 AND $groups_clause";
|
||||
|
||||
$total = db_get_value_sql($sql);
|
||||
} else {
|
||||
$partial = tactical_status_modules_agents($config['id_user'], false, 'AR');
|
||||
|
||||
$total = (int) $partial['_monitor_total_'];
|
||||
}
|
||||
|
||||
$data = [
|
||||
'type' => 'string',
|
||||
|
|
Loading…
Reference in New Issue