diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 6024979a55..f98dae5bf9 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -2426,7 +2426,7 @@ function config_process_config()
}
if (!isset($config['max_hours_old_event_comment'])) {
- config_update_value('max_hours_old_event_comment', 48);
+ config_update_value('max_hours_old_event_comment', 8);
}
if (!isset($config['elasticsearch_ip'])) {
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 16a92f789e..28a931c3c4 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -5195,54 +5195,9 @@ function events_page_comments($event, $groupedComments=[], $filter=null)
}
}
- if (((tags_checks_event_acl(
- $config['id_user'],
- $event['id_grupo'],
- 'EM',
- (isset($event['clean_tags']) === true) ? $event['clean_tags'] : [],
- []
- )) || (tags_checks_event_acl(
- $config['id_user'],
- $event['id_grupo'],
- 'EW',
- (isset($event['clean_tags']) === true) ? $event['clean_tags'] : [],
- []
- )))
- ) {
- $event['evento'] = io_safe_output($event['evento']);
- $comments_form = '
';
- }
-
- $table_filter = new stdClass;
- $table_filter->width = '100%';
- $table_filter->class = 'databox filters no_border filter-table-adv';
- $table_filter->size = [];
- $table_filter->size[0] = '80%';
- $table_filter->data = [];
- $table_filter->data[0][0] = html_print_label_input_block(
- __('Max. hours old').ui_print_help_tip(__('Hours filter comments'), true),
+ $comments_filter = '';
+ $comments_filter .= html_print_label_input_block(
+ null,
html_print_extended_select_for_time(
'comments_events_max_hours_old',
$filter['event_view_hr_cs'],
@@ -5269,24 +5224,70 @@ function events_page_comments($event, $groupedComments=[], $filter=null)
)
);
- $event = base64_encode(json_encode($event));
- $filter = base64_encode(json_encode($filter));
-
- $table_filter->data[0][1] = html_print_submit_button(
+ $eventb64 = base64_encode(json_encode($event));
+ $filterb64 = base64_encode(json_encode($filter));
+ $comments_filter .= html_print_submit_button(
__('Filter'),
'filter_comments_button',
false,
[
- 'class' => 'mini',
+ 'class' => 'mini mrgn_lft_15px',
'icon' => 'search',
- 'onclick' => 'get_table_events_tabs("'.$event.'","'.$filter.'")',
+ 'onclick' => 'get_table_events_tabs("'.$eventb64.'","'.$filterb64.'")',
],
true
);
+ $comments_filter .= '
';
- $comments_time_input = html_print_table($table_filter, true);
+ if (((tags_checks_event_acl(
+ $config['id_user'],
+ $event['id_grupo'],
+ 'EM',
+ (isset($event['clean_tags']) === true) ? $event['clean_tags'] : [],
+ []
+ )) || (tags_checks_event_acl(
+ $config['id_user'],
+ $event['id_grupo'],
+ 'EW',
+ (isset($event['clean_tags']) === true) ? $event['clean_tags'] : [],
+ []
+ )))
+ ) {
+ $event['evento'] = io_safe_output($event['evento']);
+ $comments_form = '
';
+ } else {
+ $comments_form = $comments_filter;
+ }
+
+ return $comments_form.html_print_table($table_comments, true);
}
@@ -6013,6 +6014,11 @@ function event_get_comment($event, $filter=null)
' AND tevent_comment.utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d SECOND) ',
$filter['event_view_hr_cs']
);
+ } else if (isset($filter['event_view_hr']) === true && ($filter['event_view_hr'] > 0)) {
+ $whereGrouped[] = sprintf(
+ ' AND tevent_comment.utimestamp > UNIX_TIMESTAMP(now() - INTERVAL %d SECOND) ',
+ ((int) $filter['event_view_hr'] * 3600)
+ );
}
}
@@ -6024,7 +6030,7 @@ function event_get_comment($event, $filter=null)
// Default grouped message filtering (evento and estado).
$whereGrouped[] = sprintf(
'AND `tevento`.`evento` = "%s"',
- $event['evento']
+ io_safe_input(io_safe_output($event['evento']))
);
// If id_agente is reported, filter the messages by them as well.
@@ -6044,7 +6050,7 @@ function event_get_comment($event, $filter=null)
} else if ($mode === EVENT_GROUP_REP_EXTRAIDS) {
$whereGrouped[] = sprintf(
'AND `tevento`.`id_extra` = "%s"',
- io_safe_output($event['id_extra'])
+ io_safe_input(io_safe_output($event['id_extra']))
);
} else {
$whereGrouped[] = sprintf('AND `tevento`.`id_evento` = %d', $event['id_evento']);
@@ -6125,7 +6131,7 @@ function event_get_counter_extraId(array $event, ?array $filters)
$where[] = sprintf(
'AND `te`.`id_extra` = "%s"',
- io_safe_output($event['id_extra'])
+ $event['id_extra']
);
try {
diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css
index 4f7b639eaa..c750550595 100644
--- a/pandora_console/include/styles/events.css
+++ b/pandora_console/include/styles/events.css
@@ -558,3 +558,10 @@ div#sunburst > svg {
width: 750px;
height: 750px;
}
+
+div.container-filter-buttons {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+}
diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php
index 28f88ec8ab..caf2e70c76 100644
--- a/pandora_console/operation/events/events.php
+++ b/pandora_console/operation/events/events.php
@@ -653,7 +653,7 @@ if (is_ajax() === true) {
// Grouped events.
if ((int) $filter['group_rep'] === EVENT_GROUP_REP_EXTRAIDS) {
$counter_extra_id = event_get_counter_extraId($item, $filter);
- if (empty($counter_extra_id) === false && $counter_extra_id > 0) {
+ if (empty($counter_extra_id) === false && $counter_extra_id > 1) {
$evn .= '('.$counter_extra_id.') ';
}
} else {
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index a5cb0bc731..b90044db58 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -4098,7 +4098,7 @@ sub pandora_event {
$module_status = defined($module) ? $module->{'estado'} : 0 unless defined ($module_status);
# If the event is created with validated status, assign ack_utimestamp
- my $ack_utimestamp = $event_status == 1 ? time() : 0;
+ my $ack_utimestamp = ($event_status == 1 || $event_status == 2) ? time() : 0;
my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime ($utimestamp));
@@ -4117,6 +4117,7 @@ sub pandora_event {
# Only when the event comes as New. Validated events are excluded
if (defined($id_extra_inprocess_count) && $id_extra_inprocess_count > 0 && $event_status == 0) {
logger($pa_config, "Keeping In process status from last event with extended id '$id_extra'.", 10);
+ $ack_utimestamp = get_db_value ($dbh, 'SELECT ack_utimestamp FROM tevento WHERE id_extra=? AND estado=2', $id_extra);
$event_status = 2;
}
}