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



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1943 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-09-15 13:56:48 +00:00
parent 97c73a7fec
commit 12ff422a13
3 changed files with 29 additions and 3 deletions

View File

@ -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 * 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 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. that it's not proc or string, and this ids use to test.
Fixes: 2849325 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 * godmode/reporting/map_builder.php: change (at the moment) the ajax for
delete elements by html static form with select, because sometimes (when you delete elements by html static form with select, because sometimes (when you

View File

@ -109,7 +109,7 @@ if ($create_alert) {
$id_alert_template = (int) get_parameter ('template'); $id_alert_template = (int) get_parameter ('template');
$id_agent_module = (int) get_parameter ('id_agent_module'); $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 FROM talert_template_modules
WHERE id_agent_module = " . $id_agent_module . " WHERE id_agent_module = " . $id_agent_module . "
AND id_alert_template = " . $id_alert_template) > 0) { AND id_alert_template = " . $id_alert_template) > 0) {

View File

@ -1604,6 +1604,24 @@ function get_db_value_filter ($field, $table, $filter, $where_join = 'AND') {
return $result[0][$field]; 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. * Get the first row of an SQL database query.
* *