Visual Console Refactor: minor fix

Former-commit-id: c055042c1cf3b4181a146857f159d656b9c5ed3f
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-23 16:23:32 +02:00
parent 5e3f3500c4
commit cb6b8531df
1 changed files with 18 additions and 8 deletions

View File

@ -226,20 +226,30 @@ final class Group extends Item
); );
} else { } else {
if (\is_metaconsole()) { if (\is_metaconsole()) {
$groupFilter = $groupId;
if ($groupId === 0) { if ($groupId === 0) {
$groupId = \implode(',', \array_keys(\users_get_groups())); $groupFilter = implode(
',',
array_keys(\users_get_groups())
);
} }
$sql = 'SELECT SUM(fired_count) AS fired, $sql = sprintf(
SUM(critical_count) AS critical, 'SELECT
SUM(warning_count) AS warning, SUM(fired_count) AS fired,
SUM(unknown_count) AS unknown SUM(critical_count) AS critical,
SUM(warning_count) AS warning,
SUM(unknown_count) AS unknown
FROM tmetaconsole_agent FROM tmetaconsole_agent
LEFT JOIN tmetaconsole_agent_secondary_group tasg LEFT JOIN tmetaconsole_agent_secondary_group tasg
ON id_agente = tasg.id_agent ON id_agente = tasg.id_agent
WHERE id_grupo IN ('.$groupId.') OR tasg.id_group IN ('.$groupId.')'; WHERE id_grupo IN (%s)
OR tasg.id_group IN (%s)',
$groupFilter,
$groupFilter
);
$countStatus = db_get_row_sql($sql); $countStatus = \db_get_row_sql($sql);
if ($countStatus['fired'] > 0) { if ($countStatus['fired'] > 0) {
$status = AGENT_STATUS_ALERT_FIRED; $status = AGENT_STATUS_ALERT_FIRED;