2011-09-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_agents.php: Avoid bad syntax sql query
        in agents_get_modules_data_count() function when an agent doesn't
        have modules.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4962 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-09-16 10:22:21 +00:00
parent e43929d2dc
commit 863a8c3047
2 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2011-09-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_agents.php: Avoid bad syntax sql query
in agents_get_modules_data_count() function when an agent doesn't
have modules.
2011-09-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/help/en/help_export_server.php

View File

@ -1191,14 +1191,16 @@ function agents_get_modules_data_count ($id_agent = 0) {
$count["total"] = 0;
$query[0] = "SELECT COUNT(*) FROM tagente_datos";
foreach ($id_agent as $agent_id) {
//Init value
$count[$agent_id] = 0;
$modules = array_keys (agents_get_modules ($agent_id));
foreach ($query as $sql) {
$modules = array_keys (agents_get_modules ($agent_id));
foreach ($query as $sql) {
//Add up each table's data
$count[$agent_id] += (int) db_get_sql ($sql." WHERE id_agente_modulo IN (".implode (",", $modules).")", 0, true);
//Avoid the count over empty array
if (!empty($modules))
$count[$agent_id] += (int) db_get_sql ($sql." WHERE id_agente_modulo IN (".implode (",", $modules).")", 0, true);
}
//Add total agent count to total count
$count["total"] += $count[$agent_id];