From f5eb6a24f0098077def4aa0d3b0688671ae31a84 Mon Sep 17 00:00:00 2001
From: vgilc <noreply@pandorafms.org>
Date: Wed, 18 Jan 2012 10:09:58 +0000
Subject: [PATCH] 2012-01-18  Vanessa Gil  <vanessa.gil@artica.es>

	* include/functions_agents.php
	  operation/agentes/estado_monitores.php: Counter modified to ignore
	disabled modules.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5386 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                              | 6 ++++++
 pandora_console/include/functions_agents.php           | 4 ++--
 pandora_console/operation/agentes/estado_monitores.php | 3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index b42314e8e3..7317f8d536 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-18  Vanessa Gil  <vanessa.gil@artica.es>
+
+	* include/functions_agents.php
+	  operation/agentes/estado_monitores.php: Counter modified to ignore
+	disabled modules.
+
 2012-01-18  Junichi Satoh  <junichi@rworks.jp>
 
 	* include/help/ja/help_pcap_filter.php: Added a new help file.
diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php
index 59b0bf0ba2..e4ddd3d100 100644
--- a/pandora_console/include/functions_agents.php
+++ b/pandora_console/include/functions_agents.php
@@ -192,7 +192,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
 		$selectText = 'COUNT(talert_template_modules.id) AS count';
 	}
 
-	$extra_sql = enterprise_hook('policies_get_modules_sql_condition', array(reset($id_agent), 't3.'));
+	$extra_sql = enterprise_hook('policies_get_modules_sql_condition', array(reset($id_agent), 't3.', false));
 	if ($extra_sql === ENTERPRISE_NOT_HOOK) {
 		$extra_sql = '';
 	}else if ($extra_sql != '') {
@@ -981,7 +981,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
 
 	$extra_sql = '';
 	if ($id_agent != 0){
-		$extra_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent));
+		$extra_sql = enterprise_hook('policies_get_modules_sql_condition', array($id_agent, '', false));
 		if ($extra_sql === ENTERPRISE_NOT_HOOK) {
 			$extra_sql = '';
 		}else if ($extra_sql != '') {
diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php
index d62bd681a9..56182eab41 100644
--- a/pandora_console/operation/agentes/estado_monitores.php
+++ b/pandora_console/operation/agentes/estado_monitores.php
@@ -178,7 +178,7 @@ switch ($config["dbtype"]) {
 			ORDER BY tagente_modulo.id_module_group , %s %s
 			", $id_agente, $order['field'], $order['order']);	*/
 		$sql = sprintf("
-			SELECT * FROM tagente_estado, (SELECT * FROM tagente_modulo WHERE id_agente = %d AND delete_pending = 0) tagente_modulo 
+			SELECT * FROM tagente_estado, (SELECT * FROM tagente_modulo WHERE id_agente = %d AND delete_pending = 0 AND disabled = 0) tagente_modulo 
 				LEFT JOIN tmodule_group ON tagente_modulo.id_module_group = tmodule_group.id_mg 
 			WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo 
 				AND %s tagente_estado.utimestamp != 0  
@@ -198,6 +198,7 @@ switch ($config["dbtype"]) {
 			WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
 				AND tagente_modulo.id_agente = %d 
 				AND tagente_modulo.delete_pending = 0
+				AND tagente_modulo.disabled = 0
 				AND tagente_estado.utimestamp != 0 
 			ORDER BY tagente_modulo.id_module_group , %s %s
 			", $id_agente, $order['field'], $order['order']);