From 7db96de1c2ab7534bd72d9c6229d22b34c8c6542 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 23 Feb 2011 14:49:16 +0000
Subject: [PATCH] 2011-02-23 Miguel de Dios  <miguel.dedios@artica.es>

	* pandora_console/include/functions_db.php: fixed in the function
	"get_agent_modules" extract the agents when the current user user is admin.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4004 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                | 5 +++++
 pandora_console/include/functions_db.php | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 1503f5ff2e..45a0d21d51 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-23 Miguel de Dios  <miguel.dedios@artica.es>
+
+	* pandora_console/include/functions_db.php: fixed in the function
+	"get_agent_modules" extract the agents when the current user user is admin.
+
 2011-02-23 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
 
 	* include/functions_config.php: Fixed an error at the momment of accept the 
diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php
index 2402c7eab4..4b6ca111cc 100644
--- a/pandora_console/include/functions_db.php
+++ b/pandora_console/include/functions_db.php
@@ -707,7 +707,14 @@ function get_agent_modules ($id_agent = null, $details = false, $filter = false,
 		$groups = get_user_groups(false, 'AR', false);
 		$id_groups = array_keys($groups);
 		
-		$id_agent = get_db_sql("SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")");
+		$sql = "SELECT id_agente FROM tagente WHERE id_grupo IN (" . implode(',', $id_groups) . ")";
+		$id_agent = get_db_all_rows_sql($sql);
+		
+		$temp = array();
+		foreach ($id_agent as $item) {
+			$temp[] = $item['id_agente'];
+		}
+		$id_agent = $temp;
 	}
 	
 	$id_agent = safe_int ($id_agent, 1);