From dd52f55a2f509c021c03aa5011d40ae96bfa03e6 Mon Sep 17 00:00:00 2001 From: mdtrooper <tres.14159@gmail.com> Date: Fri, 18 Sep 2009 15:14:44 +0000 Subject: [PATCH] 2009-09-17 Miguel de Dios <miguel.dedios@artica.es> * include/functions_modules.php: change the function "update_agent_module" for to add the update only that not delete pending. * godmode/agentes/massive_edit_modules.php: fix form to set disabled and history data as select box instead checkbox that this had bug because it was disabled didn't set false or true in db. Fixes: 2860987 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1955 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ .../godmode/agentes/massive_edit_modules.php | 13 +++++++++---- pandora_console/include/functions_modules.php | 12 +++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 52f1ab8024..69704b60af 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2009-09-17 Miguel de Dios <miguel.dedios@artica.es> + + * include/functions_modules.php: change the function "update_agent_module" + for to add the update only that not delete pending. + * godmode/agentes/massive_edit_modules.php: fix form to set disabled and + history data as select box instead checkbox that this had bug because + it was disabled didn't set false or true in db. + Fixes: 2860987 + 2009-09-17 Miguel de Dios <miguel.dedios@artica.es> * pandora_console/godmode/reporting/map_builder.php: add parameter to ajax diff --git a/pandora_console/godmode/agentes/massive_edit_modules.php b/pandora_console/godmode/agentes/massive_edit_modules.php index 7659ae0279..498bca7ae5 100644 --- a/pandora_console/godmode/agentes/massive_edit_modules.php +++ b/pandora_console/godmode/agentes/massive_edit_modules.php @@ -55,6 +55,10 @@ function process_manage_edit ($module_name, $group_select = null, $agents_select $values[$field] = $value; } + if (strlen(get_parameter('history_data')) > 0) { + $values['history_data'] = get_parameter('history_data'); + } + $modules = get_db_all_rows_filter ('tagente_modulo', array ('id_agente' => $agents, 'nombre' => $module_name), @@ -65,7 +69,7 @@ function process_manage_edit ($module_name, $group_select = null, $agents_select if ($modules === false) return false; foreach ($modules as $module) { - $result = update_agent_module ($module['id_agente_modulo'], $values); + $result = update_agent_module ($module['id_agente_modulo'], $values, true); if ($result === false) { process_sql_rollback (); @@ -185,7 +189,8 @@ $table->data['edit1'][3] .= print_input_text ('max_critical', '', '', 5, 15, tru $table->data['edit2'][0] = __('Interval'); $table->data['edit2'][1] = print_input_text ('module_interval', '', '', 5, 15, true); $table->data['edit2'][2] = __('Disabled'); -$table->data['edit2'][3] = print_checkbox ("disabled", 1, '', true); +//$table->data['edit2'][3] = print_checkbox ("disabled", 1, '', true); +$table->data['edit2'][3] = print_select(array('' => '', '1' => __('Yes'), '0' => __('No')),'disabled','','','', '', true); $table->data['edit3'][0] = __('Post process'); $table->data['edit3'][1] = print_input_text ('post_process', '', '', 10, 15, true); @@ -197,7 +202,7 @@ $table->data['edit4'][1] = '<em>'.__('Min.').'</em>'; $table->data['edit4'][1] .= print_input_text ('min', '', '', 5, 15, true); $table->data['edit4'][1] .= '<br /><em>'.__('Max.').'</em>'; $table->data['edit4'][1] .= print_input_text ('max', '', '', 5, 15, true); -$table->data['edit4'][2] = __('Group'); +$table->data['edit4'][2] = __('Module group'); $table->data['edit4'][3] = print_select (get_modulegroups(), 'id_module_group', '', '', __('Select'), 0, true, false, false); @@ -214,7 +219,7 @@ $table->data['edit6'][1] = print_select_from_sql ('SELECT id, name FROM tserver_ $table->data['edit7'][0] = __('FF threshold').' '.print_help_icon ('ff_threshold', true); $table->data['edit7'][1] = print_input_text ('min_ff_event', '', '', 5, 15, true); $table->data['edit7'][2] = __('Historical data'); -$table->data['edit7'][3] = print_checkbox ("history_data", 1, '', true); +$table->data['edit7'][3] = print_select(array('' => '', '1' => __('Yes'), '0' => __('No')),'history_data','','','', '', true); echo '<form method="post" id="form_edit" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">'; print_table ($table); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 6d340fb42d..cda87d9e25 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -140,14 +140,20 @@ function delete_agent_module ($id_agent_module) { * * @return True if the module was updated. False if not. */ -function update_agent_module ($id, $values) { +function update_agent_module ($id, $values, $onlyNoDeletePending = false) { if (! is_array ($values) || empty ($values)) return false; if (isset ($values['nombre']) && empty ($values['nombre'])) return false; - return (@process_sql_update ('tagente_modulo', $values, - array ('id_agente_modulo' => (int) $id)) !== false); + if ($onlyNoDeletePending) { + return (@process_sql_update ('tagente_modulo', $values, + array ('id_agente_modulo' => (int) $id, 'delete_pending' => 0)) !== false); + } + else { + return (@process_sql_update ('tagente_modulo', $values, + array ('id_agente_modulo' => (int) $id)) !== false); + } } /**