#12376 fixed only enabled alerts in tactical view

This commit is contained in:
Daniel Cebrian 2023-11-08 13:36:43 +01:00
parent 7223423dc7
commit 3132fabef9
2 changed files with 6 additions and 2 deletions

View File

@ -22,7 +22,7 @@ require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_users.php';
function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0)
function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby=-1, $acl=false, $total=false, $id_agent=0, $only_enabled=false)
{
$sql = '';
$alerts = [];
@ -121,6 +121,10 @@ function alerts_get_alerts($id_group=0, $free_search='', $status='all', $standby
// Only enabled agent.
$sql .= ' AND t3.disabled = 0';
if ($only_enabled === true) {
$sql .= ' AND t0.disabled = 0';
}
$row_alerts = db_get_all_rows_sql($sql);
if ($total) {

View File

@ -83,7 +83,7 @@ class Alerts extends Element
*/
public function getActiveAlerts():string
{
$total = alerts_get_alerts(0, '', 'all', -1, 'AR', true);
$total = alerts_get_alerts(0, '', 'all', -1, 'AR', true, 0, true);
return html_print_div(
[
'content' => format_numeric($total, 0),