From 597ed7e17adc02b7108ba3127a20022a45802d8e Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Thu, 18 Aug 2011 10:36:33 +0000 Subject: [PATCH] 2011-08-17 Juan Manuel Ramon * include/functions_modules.php: Format decimal numeric data in function modules_get_agentmodule when DB is Oracle. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4765 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_modules.php | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b0864b7124..8e20558a9c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-08-17 Juan Manuel Ramon + + * include/functions_modules.php: Format decimal numeric data + in function modules_get_agentmodule when DB is Oracle. + 2011-08-18 Sergio Martin * operation/agentes/estado_generalagente.php: Changed the diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index be0ead72e9..79b8365a90 100644 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -448,9 +448,26 @@ function modules_format_delete_log4x($id) * @return array An array with module information */ function modules_get_agentmodule ($id_agentmodule) { - return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); + global $config; + + switch ($config['dbtype']){ + case "mysql": + case "postgresql": + return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); + break; + case "oracle": + $fields = db_get_all_rows_filter('USER_TAB_COLUMNS', 'TABLE_NAME = \'TAGENTE_MODULO\' AND COLUMN_NAME <> \'MAX_CRITICAL\' AND COLUMN_NAME <> \'MIN_CRITICAL\' AND COLUMN_NAME <> \'POST_PROCESS\' AND COLUMN_NAME <> \'MAX_WARNING\' AND COLUMN_NAME <> \'MIN_WARNING\'', 'COLUMN_NAME'); + foreach ($fields as $field){ + $fields_[] = $field['column_name']; + } + $fields = implode(',', $fields_); + $result = db_process_sql("SELECT TO_NUMBER(MAX_CRITICAL) as max_critical, TO_NUMBER(MIN_CRITICAL) as min_critical, TO_NUMBER(MAX_WARNING) as max_warning, TO_NUMBER(MIN_WARNING) as min_warning, TO_NUMBER(POST_PROCESS) as post_process, " . $fields . " FROM tagente_modulo WHERE id_agente_modulo = " . $id_agentmodule); + return $result[0]; + break; + } } + /** * Get a id of module from his name and the agent id *