diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index d6a760413b..c320f2b5d7 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1147,12 +1147,37 @@ if ($change_status) { $event_ids = get_parameter('event_ids'); $new_status = get_parameter('new_status'); - $return = events_change_status(explode(',', $event_ids), $new_status, $meta, $history); + $return = events_change_status( + explode(',', $event_ids), + $new_status, + $meta, + $history + ); - if ($return) { - echo 'status_ok'; + if ($return !== false) { + echo json_encode( + [ + 'status' => 'status_ok', + 'user' => db_get_value( + 'fullname', + 'tusuario', + 'id_user', + $config['id_user'] + ), + ] + ); } else { - echo 'status_error'; + echo json_encode( + [ + 'status' => 'status_error', + 'user' => db_get_value( + 'fullname', + 'tusuario', + 'id_user', + $config['id_user'] + ), + ] + ); } return; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 56df5325cd..33c2309e30 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4701,16 +4701,24 @@ function events_page_general($event) $table_general->data[] = $data; // If event is validated, show who and when acknowleded it. + $table_general->cellclass[8][1] = 'general_acknowleded'; + $data = []; $data[0] = __('Acknowledged by'); if ($event['estado'] == 1) { - $user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); - if (empty($user_ack)) { + $user_ack = db_get_value( + 'fullname', + 'tusuario', + 'id_user', + $event['id_usuario'] + ); + + if (empty($user_ack) === true) { $user_ack = $event['id_usuario']; } - $date_ack = date($config['date_format'], $event['ack_utimestamp']); + $date_ack = io_safe_output($event['ack_utimestamp']); $data[1] = $user_ack.' ('.$date_ack.')'; } else { $data[1] = ''.__('N/A').''; diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 55c8ecb74a..c1b604b4e2 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -453,7 +453,6 @@ function perform_response_massive(response, response_id, out_iterator) { // Change the status of an event to new, in process or validated. function event_change_status(event_ids) { var new_status = $("#estado").val(); - var event_id = $("#hidden-id_event").val(); var meta = $("#hidden-meta").val(); var history = $("#hidden-history").val(); @@ -472,7 +471,7 @@ function event_change_status(event_ids) { type: "POST", url: $("#hidden-ajax_file").val(), async: true, - dataType: "html", + dataType: "json", success: function(data) { $("#button-status_button").removeAttr("disabled"); $("#response_loading").hide(); @@ -485,11 +484,20 @@ function event_change_status(event_ids) { $("#notification_status_error").hide(); } - if (data == "status_ok") { + if (data.status == "status_ok") { if (typeof dt_events !== "undefined") { dt_events.draw(false); } $("#notification_status_success").show(); + if (new_status == 1) { + $("#extended_event_general_page table td.general_acknowleded").text( + data.user + ); + } else { + $("#extended_event_general_page table td.general_acknowleded").text( + "N/A" + ); + } } else { $("#notification_status_error").show(); } @@ -942,7 +950,6 @@ function execute_event_response(event_list_btn) { }); break; case "delete_selected": - console.log($(this)); $(".chk_val:checked").each(function() { execute_delete_event_reponse( dt_events,