diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 4040edb546..8e9c026d77 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -401,15 +401,8 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal case '1': // Group by events. - $event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']); - $filter['group_rep'] = 0; - $filter['status'] = $event['estado']; - $filter['event_type'] = $event['event_type']; - $filter['id_agent'] = $event['id_agente']; - $filter['id_agentmodule'] = $event['id_agentmodule']; - $sql = events_get_all( - ['te.id_evento'], + ['te.*'], $filter, // Offset. null, @@ -425,7 +418,18 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal true ); - $target_ids = db_get_all_rows_sql($sql); + $target_ids = db_get_all_rows_sql( + sprintf( + 'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf + ON tu.estado = tf.estado + AND tu.evento = tf.evento + AND tu.id_agente = tf.id_agente + AND tu.id_agentmodule = tf.id_agentmodule + AND tf.max_id_evento = %d', + $sql, + $id_evento + ) + ); // Try to avoid deadlock while updating full set. if ($target_ids !== false && count($target_ids) > 0) { @@ -490,15 +494,8 @@ function events_update_status($id_evento, $status, $filter=null) case '1': // Group by events. - $event = events_get_event($id_evento, ['estado', 'event_type', 'id_agente', 'id_agentmodule']); - $filter['group_rep'] = 0; - $filter['status'] = $event['estado']; - $filter['event_type'] = $event['event_type']; - $filter['id_agent'] = $event['id_agente']; - $filter['id_agentmodule'] = $event['id_agentmodule']; - $sql = events_get_all( - ['te.id_evento'], + ['te.*'], $filter, // Offset. null, @@ -514,7 +511,18 @@ function events_update_status($id_evento, $status, $filter=null) true ); - $target_ids = db_get_all_rows_sql($sql); + $target_ids = db_get_all_rows_sql( + sprintf( + 'SELECT tu.id_evento FROM tevento tu INNER JOIN ( %s ) tf + ON tu.estado = tf.estado + AND tu.evento = tf.evento + AND tu.id_agente = tf.id_agente + AND tu.id_agentmodule = tf.id_agentmodule + AND tf.max_id_evento = %d', + $sql, + $id_evento + ) + ); // Try to avoid deadlock while updating full set. if ($target_ids !== false && count($target_ids) > 0) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 213f406056..08936c170b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -5106,7 +5106,7 @@ function reporting_custom_render($report, $content, $type='dinamic', $pdf=0) $data_macro['server_id'] ); if (metaconsole_connect($server) != NOERR) { - continue; + continue 2; } } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 57abcee37d..d0e747e031 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3462,7 +3462,8 @@ function ui_print_datatable(array $parameters) $(document).ready(function(){ $.fn.dataTable.ext.errMode = "none"; $.fn.dataTable.ext.classes.sPageButton = "'.$pagination_class.'"; - dt_'.$table_id.' = $("#'.$table_id.'").DataTable({ + + var settings_datatable = { drawCallback: function(settings) {'; if (isset($parameters['drawCallback'])) { $js .= $parameters['drawCallback']; @@ -3608,7 +3609,9 @@ function ui_print_datatable(array $parameters) $js .= ' ], order: [[ '.$order.' ]] - }); + }; + + var dt_'.$table_id.' = $("#'.$table_id.'").DataTable(settings_datatable); $("#'.$form_id.'_search_bt").click(function (){ dt_'.$table_id.'.draw().page(0) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index a6d141f82c..1ca059859d 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2213,11 +2213,9 @@ try { $active_filters_div .= ''; $active_filters_div .= '
'; - $table_id = 'events'; + $table_id = 'table_events'; $form_id = 'events_form'; - - // Print datatable. ui_print_datatable( [