Fixed an SQL error

This commit is contained in:
Alejandro Gallardo Escobar 2015-03-04 13:35:52 +01:00
parent 7e7e40dd02
commit b79d572959
2 changed files with 11 additions and 6 deletions

View File

@ -7872,11 +7872,16 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
$counts_info['total_count'] = $counts_info['normal_count'] + $counts_info['warning_count'] + $counts_info['critical_count'] + $counts_info['unknown_count'] + $counts_info['notinit_count'];
$all_agent_modules = tags_get_agent_modules ($id_agent, $acltags, false, $filter);
$mod_clause = "(".implode(',', array_keys($all_agent_modules)).")";
$counts_info['fired_count'] = db_get_sql ("SELECT COUNT(times_fired)
FROM talert_template_modules
WHERE times_fired != 0 AND id_agent_module IN ".$mod_clause);
if (!empty($all_agent_modules)) {
$mod_clause = "(".implode(',', array_keys($all_agent_modules)).")";
$counts_info['fired_count'] = (int) db_get_sql ("SELECT COUNT(times_fired)
FROM talert_template_modules
WHERE times_fired != 0 AND id_agent_module IN ".$mod_clause);
}
else {
$counts_info['fired_count'] = 0;
}
}
// Store the counts in a data structure to print hidden divs with titles

View File

@ -1996,7 +1996,7 @@ function tags_get_agent_modules ($id_agent, $groups_and_tags = array(), $fields
// Avoid mysql error
if (empty($id_agent))
return;
return false;
if (!is_array ($fields)) {
$fields = array ();