fixed get events API pandora_enterprise#9723

This commit is contained in:
Daniel Barbero 2022-11-10 09:19:32 +01:00
parent b8939cb624
commit c16901a5e2
2 changed files with 3 additions and 10 deletions

View File

@ -11310,7 +11310,7 @@ function api_get_events($node_id, $trash2, $other, $returnType)
$separator = (isset($other['data'][0]) === true && empty($other['data'][0]) === false) ? $other['data'][0] : ';';
if (is_metaconsole() === true) {
if (empty($node_id) === true && (int) $node_id !== 0) {
if (empty($node_id) === true && $node_id != 0) {
$node_id = array_keys(metaconsole_get_names(['disabled' => 0]));
$node_id[] = 0;
} else {

View File

@ -800,7 +800,7 @@ function events_get_all(
}
}
if (isset($filter['severity']) === true) {
if (isset($filter['severity']) === true && $filter['severity'] !== '') {
if (is_array($filter['severity']) === true) {
if (in_array(-1, $filter['severity']) === false) {
$not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']);
@ -1033,14 +1033,13 @@ function events_get_all(
// Prepare agent join sql filters.
$table = 'tevento';
$tevento = 'tevento te';
$agent_join_filters = [];
$tagente_table = 'tagente';
$tagente_field = 'id_agente';
$conditionMetaconsole = '';
// Agent alias.
if (empty($filter['agent_alias']) === false) {
$agent_join_filters[] = sprintf(
$sql_filters[] = sprintf(
' AND ta.alias = "%s" ',
$filter['agent_alias']
);
@ -1561,7 +1560,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
WHERE 1=1
@ -1577,7 +1575,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
%s
@ -1593,7 +1590,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),
@ -1607,7 +1603,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),
@ -1623,7 +1618,6 @@ function events_get_all(
%s JOIN %s ta
ON ta.%s = te.id_agente
%s
%s
%s JOIN tgrupo tg
ON %s
WHERE 1=1
@ -1642,7 +1636,6 @@ function events_get_all(
$tagente_table,
$tagente_field,
$conditionMetaconsole,
join(' ', $agent_join_filters),
$tgrupo_join,
join(' ', $tgrupo_join_filters),
join(' ', $sql_filters),