Merge branch 'ent-12896-corregir-la-query-del-ticket-12124' into 'develop'

Ent-12896-corregir-la-query-del-ticket-12124

Closes pandora_enterprise#12896

See merge request artica/pandorafms!6947
This commit is contained in:
Rafael Ameijeiras 2024-02-21 08:01:27 +00:00
commit bf82e3c38f
1 changed files with 5 additions and 2 deletions

View File

@ -7197,12 +7197,15 @@ sub pandora_disable_autodisable_agents ($$) {
SELECT tm.id_agente, count(*) as sync_modules, ta.unknown_count
FROM tagente_modulo tm
JOIN tagente ta ON ta.id_agente = tm.id_agente
LEFT JOIN tagente_estado te ON tm.id_agente_modulo = te.id_agente_modulo
WHERE ta.disabled = 0
AND ta.modo=2
AND te.estado != 4
AND tm.delete_pending=0
AND NOT ((id_tipo_modulo >= 21 AND id_tipo_modulo <= 23) OR id_tipo_modulo = 100)
GROUP BY tm.id_agente
) AS subquery
WHERE subquery.unknown_count >= subquery.sync_modules;';
WHERE subquery.unknown_count >= subquery.sync_modules;';
my @agents_autodisabled = get_db_rows ($dbh, $sql);
return if ($#agents_autodisabled < 0);