From b81b7ce7afb57675e022d28838224d8f16488f32 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Fri, 17 Mar 2023 12:25:43 +0100 Subject: [PATCH] #fixed in fav menu when change name the original name --- .../godmode/agentes/configurar_agente.php | 2 ++ .../godmode/events/event_edit_filter.php | 2 ++ pandora_console/godmode/groups/group_list.php | 1 + .../godmode/reporting/reporting_builder.php | 2 ++ .../reporting/visual_console_builder.php | 1 + pandora_console/include/ajax/module.php | 1 + pandora_console/include/functions_ui.php | 18 ++++++++++++++++++ .../include/lib/Dashboard/Manager.php | 4 ++++ .../operation/agentes/pandora_networkmap.php | 1 + .../agentes/pandora_networkmap.view.php | 1 + 10 files changed, 33 insertions(+) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 04b90c1bb1..c44d334d89 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1195,6 +1195,8 @@ if ($update_agent) { ] ); + ui_update_name_fav_element($id_agente, 'Agents', $alias); + ui_print_success_message(__('Successfully updated')); db_pandora_audit( AUDIT_LOG_AGENT_MANAGEMENT, diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index a1c9638a48..fbc60c42b0 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -237,6 +237,8 @@ if ($update) { ['id_filter' => $id] ); + ui_update_name_fav_element($id, 'Events', $id_name); + ui_print_result_message( $result, __('Successfully updated'), diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 1afd26363e..145f0e6f67 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -534,6 +534,7 @@ if ($is_management_allowed === true && $update_group === true) { } if ($result) { + ui_update_name_fav_element($id_group, 'Groups', $name); ui_print_success_message(__('Group successfully updated')); } else { ui_print_error_message(__('There was a problem modifying group')); diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index a0e25d0e04..453d5437fc 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1488,6 +1488,8 @@ switch ($action) { ['id_report' => $idReport] ); + ui_update_name_fav_element($idReport, 'Reporting', $new_values['name']); + $auditMessage = ($resultOperationDB === true) ? 'Update report' : 'Fail try to update report'; db_pandora_audit( AUDIT_LOG_REPORT_MANAGEMENT, diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index dfc73b8f67..7476790589 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -295,6 +295,7 @@ switch ($activeTab) { } if ($result !== false) { + ui_update_name_fav_element($idVisualConsole, 'Visual_Console', $values['name']); db_pandora_audit( AUDIT_LOG_VISUAL_CONSOLE_MANAGEMENT, sprintf('Update visual console #%s', $idVisualConsole) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 30b84be44f..9285df35d0 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -2051,6 +2051,7 @@ if (check_login()) { if ($result === false) { echo 'error'; } else { + ui_update_name_fav_element($id, 'Modules', $values['ag_modulename']); echo 'ok'; } } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 59a7c1bb13..4235f60780 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -7854,4 +7854,22 @@ function ui_print_fav_menu($id_element, $url, $label, $section) $output .= html_print_input_text('label_fav_menu', '', '', 25, 255, true, false, true); $output .= ''; return $output; +} + + +function ui_update_name_fav_element($id_element, $section, $label) +{ + $label = io_safe_output($label); + if (strlen($label) > 18) { + $label = io_safe_input(substr($label, 0, 18).'...'); + } + + db_process_sql_update( + 'tfavmenu_user', + ['label' => $label], + [ + 'section' => $section, + 'id_element' => $id_element, + ] + ); } \ No newline at end of file diff --git a/pandora_console/include/lib/Dashboard/Manager.php b/pandora_console/include/lib/Dashboard/Manager.php index db8235681a..a24aa8f4e9 100644 --- a/pandora_console/include/lib/Dashboard/Manager.php +++ b/pandora_console/include/lib/Dashboard/Manager.php @@ -1002,6 +1002,10 @@ class Manager implements PublicLogin $res = $this->put($values); } + if ($res !== false) { + ui_update_name_fav_element($this->dashboardId, 'Dashboard_', $name); + } + $result = [ 'error' => ($res === false) ? 1 : 0, 'error_mesage' => __('Error create or update dashboard'), diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 506f778e6d..c3f7786a2e 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -507,6 +507,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $values, ['id' => $id] ); + ui_update_name_fav_element($id, 'Network_map', $name); } $result_txt = ui_print_result_message( diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index ea8bf7629d..2bde4e0ddf 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -517,6 +517,7 @@ if (is_ajax() === true) { $return['error'] = false; error_log('Failed to reset map '.$map_id); } else { + ui_update_name_fav_element($map_id, 'Network_map', $new_values['name']); $return['error'] = true; } } else {