From 2e6354655094c7a2d8cfeeb28b1c6cf7fb9139eb Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 25 Sep 2023 11:29:38 +0200 Subject: [PATCH 1/3] add new type search status events not in process pandora_enterprise#11760 --- pandora_console/include/constants.php | 1 + pandora_console/include/functions_events.php | 23 +++++++++++++++++++ .../lib/Dashboard/Widgets/events_list.php | 1 + pandora_console/operation/events/events.php | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 889e32f693..c9644eafcb 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -45,6 +45,7 @@ define('EVENT_NEW', 0); define('EVENT_VALIDATE', 1); define('EVENT_PROCESS', 2); define('EVENT_NO_VALIDATED', 3); +define('EVENT_NO_PROCESS', 4); // Events group by constants. define('EVENT_GROUP_REP_ALL', 0); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 7068d554e6..87c945ffe0 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -982,6 +982,9 @@ function events_get_all( case EVENT_NO_VALIDATED: $filter['status'][$key] = (EVENT_NEW.', '.EVENT_PROCESS); + + case EVENT_NO_PROCESS: + $filter['status'][$key] = (EVENT_NEW.', '.EVENT_VALIDATE); default: // Ignore. break; @@ -1027,6 +1030,24 @@ function events_get_all( $validatedState ); break; + + case EVENT_NO_PROCESS: + // Show comments in validated events. + $validatedState = ''; + if ($validatedEvents === true) { + $validatedState = sprintf( + 'OR estado = %d', + EVENT_VALIDATE + ); + } + + $sql_filters[] = sprintf( + ' AND (estado = %d OR estado = %d %s)', + EVENT_NEW, + EVENT_VALIDATE, + $validatedState + ); + break; } } } @@ -3211,12 +3232,14 @@ function events_get_all_status($report=false) $fields[1] = __('Only validated'); $fields[2] = __('Only in process'); $fields[3] = __('Only not validated'); + $fields[4] = __('Only not in process'); } else { $fields[-1] = __('All event'); $fields[0] = __('New'); $fields[1] = __('Validated'); $fields[2] = __('In process'); $fields[3] = __('Not Validated'); + $fields[4] = __('Not in process'); } return $fields; diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index b7ad581dc0..7e050d3ee8 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -396,6 +396,7 @@ class EventsListWidget extends Widget 0 => \__('Only pending'), 2 => \__('Only in process'), 3 => \__('Only not validated'), + 4 => \__('Only not process'), ]; $inputs['inputs']['row1'][] = [ diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 059c8f90ec..f3fefbddf4 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2650,6 +2650,10 @@ try { case EVENT_NO_VALIDATED: $active_filters_div .= __('Not validated.'); break; + + case EVENT_NO_PROCESS: + $active_filters_div .= __('Not in process.'); + break; } $active_filters_div .= ''; From c20ca271ba430de34e7917fdbfd870a4afaf8b4a Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 6 Oct 2023 13:05:42 +0200 Subject: [PATCH 2/3] fix translate pandora_enterprise#11760 --- pandora_console/include/lib/Dashboard/Widgets/events_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 7e050d3ee8..3706c33d5e 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -396,7 +396,7 @@ class EventsListWidget extends Widget 0 => \__('Only pending'), 2 => \__('Only in process'), 3 => \__('Only not validated'), - 4 => \__('Only not process'), + 4 => \__('Only not in process'), ]; $inputs['inputs']['row1'][] = [ From 161b0e8a34782a36397e14590b2c7dc7cb2e7635 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 8 Nov 2023 10:31:42 +0100 Subject: [PATCH 3/3] Add filter eventcardboard pandora_enterprise#11760 --- pandora_console/include/functions_events.php | 40 ++++++++++++++++--- .../lib/Dashboard/Widgets/EventCardboard.php | 6 +-- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index abfee036cb..c814e137eb 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6016,17 +6016,47 @@ function get_count_event_criticity( $type = 'AND event_type = "'.$eventType.'"'; } - $groups = ' '; + $groups = ' '; if ((int) $groupId !== 0) { $groups = 'AND id_grupo IN ('.$groupId.')'; } - $status = ' '; - if ((int) $eventStatus !== -1) { - $status = 'AND estado = '.$eventStatus; + $status = ' '; + if (empty($eventStatus) === false) { + switch ($eventStatus) { + case EVENT_ALL: + default: + // Do not filter. + break; + + case EVENT_NEW: + case EVENT_VALIDATE: + case EVENT_PROCESS: + $status = sprintf( + ' AND estado = %d', + $eventStatus + ); + break; + + case EVENT_NO_VALIDATED: + $status = sprintf( + ' AND (estado = %d OR estado = %d)', + EVENT_NEW, + EVENT_PROCESS + ); + break; + + case EVENT_NO_PROCESS: + $status = sprintf( + ' AND (estado = %d OR estado = %d)', + EVENT_NEW, + EVENT_VALIDATE + ); + break; + } } - $criticity = ' '; + $criticity = ' '; if (empty($criticityId) === false) { $criticity = 'AND criticity IN ('.$criticityId.')'; } diff --git a/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php b/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php index fa2f8bb023..8ca7571790 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php +++ b/pandora_console/include/lib/Dashboard/Widgets/EventCardboard.php @@ -296,11 +296,7 @@ class EventCardboard extends Widget ]; // Event status. - $fields = [ - -1 => __('All event'), - 1 => __('Only validated'), - 0 => __('Only pending'), - ]; + $fields = events_get_all_status(true); $inputs['inputs']['row1'][] = [ 'label' => __('Event status'),