diff --git a/pandora_console/extras/mr/58.sql b/pandora_console/extras/mr/58.sql index 59a9b19c3b..54b8ed147c 100644 --- a/pandora_console/extras/mr/58.sql +++ b/pandora_console/extras/mr/58.sql @@ -3,4 +3,6 @@ START TRANSACTION; ALTER TABLE `tmodule_inventory` ADD COLUMN `script_mode` INT NOT NULL DEFAULT 2; ALTER TABLE `tmodule_inventory` ADD COLUMN `script_path` VARCHAR(1000) DEFAULT ''; +ALTER TABLE `tevent_filter` ADD COLUMN `search_recursive_groups` INT NOT NULL DEFAULT 0; + COMMIT; diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 91045ce0ea..2e7e009686 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -90,6 +90,7 @@ if ($id) { $filter_only_alert = $filter['filter_only_alert']; $search_secondary_groups = $filter['search_secondary_groups']; + $search_recursive_groups = $filter['search_recursive_groups']; $custom_data = $filter['custom_data']; $custom_data_filter_type = $filter['custom_data_filter_type']; @@ -128,6 +129,7 @@ if ($id) { $tag_without_base64 = base64_encode($tag_without_json); $filter_only_alert = ''; $search_secondary_groups = 0; + $search_recursive_groups = 0; } if ($update || $create) { @@ -170,6 +172,7 @@ if ($update || $create) { $filter_only_alert = get_parameter('filter_only_alert', ''); $search_secondary_groups = get_parameter('search_secondary_groups', 0); + $search_recursive_groups = get_parameter('search_recursive_groups', 0); $custom_data = get_parameter('custom_data', ''); $custom_data_filter_type = get_parameter('custom_data_filter_type', ''); @@ -198,6 +201,7 @@ if ($update || $create) { 'user_comment' => $user_comment, 'filter_only_alert' => $filter_only_alert, 'search_secondary_groups' => $search_secondary_groups, + 'search_recursive_groups' => $search_recursive_groups, 'custom_data' => $custom_data, 'custom_data_filter_type' => $custom_data_filter_type, ]; diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 0d0b77ffd4..8b20e93736 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -360,10 +360,11 @@ if ($save_event_filter) { ); $values['filter_only_alert'] = get_parameter('filter_only_alert'); $values['search_secondary_groups'] = get_parameter('search_secondary_groups'); + $values['search_recursive_groups'] = get_parameter('search_recursive_groups'); $values['id_group_filter'] = get_parameter('id_group_filter'); - $values['date_from'] = get_parameter('date_from'); + $values['date_from'] = get_parameter('date_from', null); $values['time_from'] = get_parameter('time_from'); - $values['date_to'] = get_parameter('date_to'); + $values['date_to'] = get_parameter('date_to', null); $values['time_to'] = get_parameter('time_to'); $values['source'] = get_parameter('source'); $values['id_extra'] = get_parameter('id_extra'); @@ -417,6 +418,7 @@ if ($update_event_filter) { ); $values['filter_only_alert'] = get_parameter('filter_only_alert'); $values['search_secondary_groups'] = get_parameter('search_secondary_groups'); + $values['search_recursive_groups'] = get_parameter('search_recursive_groups'); $values['id_group_filter'] = get_parameter('id_group_filter'); $values['date_from'] = get_parameter('date_from'); $values['time_from'] = get_parameter('time_from'); @@ -471,6 +473,7 @@ if ($get_filter_values) { 'module_search' => '', 'filter_only_alert' => '-1', 'search_secondary_groups' => 0, + 'search_recursive_groups' => 0, 'user_comment' => '', 'id_extra' => '', 'id_user_ack' => '', @@ -657,6 +660,8 @@ function load_form_filter() { $("#filter_only_alert").val(val); if (i == 'search_secondary_groups') $("#checkbox-search_secondary_groups").val(val); + if (i == 'search_recursive_groups') + $("#checkbox-search_recursive_groups").val(val); if (i == 'id_group_filter') $("#id_group_filter").val(val); if (i == 'source') @@ -900,6 +905,7 @@ function save_new_filter() { "tag_without": Base64.decode($("#hidden-tag_without").val()), "filter_only_alert" : $("#filter_only_alert").val(), "search_secondary_groups" : $("#checkbox-search_secondary_groups").val(), + "search_recursive_groups" : $("#checkbox-search_recursive_groups").val(), "id_group_filter": $("#id_group_filter_dialog").val(), "date_from": $("#text-date_from").val(), "time_from": $("#text-time_from").val(), @@ -976,6 +982,7 @@ function save_update_filter() { "tag_without" : Base64.decode($("#hidden-tag_without").val()), "filter_only_alert" : $("#filter_only_alert").val(), "search_secondary_groups" : $("#checkbox-search_secondary_groups").val(), + "search_recursive_groups" : $("#checkbox-search_recursive_groups").val(), "id_group_filter": $("#id_group_filter_dialog").val(), "date_from": $("#text-date_from").val(), "time_from": $("#text-time_from").val(), @@ -2416,6 +2423,7 @@ if ($get_events_fired) { 'tag_without' => [], 'filter_only_alert' => -1, 'search_secondary_groups' => 0, + 'search_recursive_groups' => 0, 'source' => '', 'id_extra' => '', 'user_comment' => '', diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index a9a5a7d676..9e0a3650d6 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -627,6 +627,7 @@ function events_update_status($id_evento, $status, $filter=null) * 'tag_without' * 'filter_only_alert' * 'search_secondary_groups' + * 'search_recursive_groups' * 'module_search' * 'group_rep' * 'server_id' @@ -864,7 +865,10 @@ function events_get_all( if (isset($groups) === true && (is_array($groups) === true || ($groups > 0)) ) { - if ($recursiveGroups === true) { + if ($recursiveGroups === true + || (isset($filter['search_recursive_groups']) === true + && (bool) $filter['search_recursive_groups'] === true) + ) { // Add children groups. $children = []; if (is_array($groups) === true) { diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index e289632aad..cf7c6b9a54 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -173,6 +173,10 @@ $search_secondary_groups = get_parameter( 'filter[search_secondary_groups]', 0 ); +$search_recursive_groups = get_parameter( + 'filter[search_recursive_groups]', + 0 +); $id_group_filter = get_parameter( 'filter[id_group_filter]', ($filter['id_group'] ?? '') @@ -1090,6 +1094,7 @@ if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false $filter_only_alert = $filter['filter_only_alert']; $search_secondary_groups = ($filter['search_secondary_groups'] ?? 0); + $search_recursive_groups = ($filter['search_recursive_groups'] ?? 0); $id_group_filter = $filter['id_group_filter']; $date_from = $filter['date_from']; $time_from = $filter['time_from']; @@ -1710,6 +1715,28 @@ $in = '
'; $in .= $data.'
'; $inputs[] = $in; +// Search recursive groups. +$data = html_print_checkbox_switch( + 'search_recursive_groups', + $search_recursive_groups, + $search_recursive_groups, + true, + false, + 'search_in_secondary_groups(this);', + true +); + +$in = '
'; +$in .= $data; +$in .= '
'; +$inputs[] = $in; + // Search secondary groups. $data = html_print_checkbox_switch( 'search_secondary_groups', @@ -1721,8 +1748,15 @@ $data = html_print_checkbox_switch( true ); -$in = '
'; -$in .= $data.'
'; +$in = '
'; +$in .= $data; +$in .= '
'; $inputs[] = $in; // Trick view in table. diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index a2029225ab..880f77063f 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1245,6 +1245,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `tag_without` TEXT, `filter_only_alert` INT NOT NULL DEFAULT -1, `search_secondary_groups` INT NOT NULL DEFAULT 0, + `search_recursive_groups` INT NOT NULL DEFAULT 0, `date_from` date DEFAULT NULL, `date_to` date DEFAULT NULL, `source` TINYTEXT,