diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 4f020e61de..5207298b03 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 9639d7da4e..2a91641315 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; } } } @@ -3204,12 +3225,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; @@ -5999,17 +6022,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'), diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index b7ad581dc0..3706c33d5e 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 in process'), ]; $inputs['inputs']['row1'][] = [ diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 34db92588d..1767b33c37 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2663,6 +2663,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 .= '';