diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e7a198495b..cd41bc34fc 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,11 +1,19 @@ -2009-09-14 Miguel de Dios <miguel.dedios@artica.es> +2009-09-15 Miguel de Dios <miguel.dedios@artica.es> + + * include/functions_db.php: add function "get_db_value_sql" for use in + alert_list.php and in futures uses. This function returns the first column + and first row from a query pass as parameters. + * godmode/alerts/alert_list.php: fix bug that you can't add new alerts. + Fixes: 2859264 + +2009-09-15 Miguel de Dios <miguel.dedios@artica.es> * godmode/agentes/module_manager.php: change the method for test if a module is a numeric, and can normalize. Now obtain the ids from modules tipe that it's not proc or string, and this ids use to test. Fixes: 2849325 -2009-09-14 Miguel de Dios <miguel.dedios@artica.es> +2009-09-15 Miguel de Dios <miguel.dedios@artica.es> * godmode/reporting/map_builder.php: change (at the moment) the ajax for delete elements by html static form with select, because sometimes (when you diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index cdd7685e12..f04123cfa5 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -109,7 +109,7 @@ if ($create_alert) { $id_alert_template = (int) get_parameter ('template'); $id_agent_module = (int) get_parameter ('id_agent_module'); - if (get_db_row_sql("SELECT COUNT(id) + if (get_db_value_sql("SELECT COUNT(id) FROM talert_template_modules WHERE id_agent_module = " . $id_agent_module . " AND id_alert_template = " . $id_alert_template) > 0) { diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 82b788395d..f703834bf9 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1604,6 +1604,24 @@ function get_db_value_filter ($field, $table, $filter, $where_join = 'AND') { return $result[0][$field]; } +/** + * Get the first value of the first row of a table result from query. + * + * @param string SQL select statement to execute. + * + * @return the first value of the first row of a table result from query. + * + */ +function get_db_value_sql ($sql) { + $sql .= " LIMIT 1"; + $result = get_db_all_rows_sql ($sql); + + if($result === false) + return false; + + return $result[0][0]; +} + /** * Get the first row of an SQL database query. *