From 7bb10b84f76fb97119f6bff6d0959fe8777ec30f Mon Sep 17 00:00:00 2001
From: jsatoh <junichi@rworks.jp>
Date: Mon, 5 Apr 2010 01:34:12 +0000
Subject: [PATCH] 2010-04-05  Junichi Satoh <junichi@rworks.jp>

	* lib/PandoraFMS/Core.pm: Fixed the problem that agent status(estado)
	is never updated to $new_status if initial state of new agent is
	"estado != last_status" with "$new_status == last_status".
	eg) When new agents are added by recontask, estado=1 and last_status=0
	are set.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2535 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_server/ChangeLog              | 8 ++++++++
 pandora_server/lib/PandoraFMS/Core.pm | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog
index 04428748b8..7e942f2607 100644
--- a/pandora_server/ChangeLog
+++ b/pandora_server/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-05  Junichi Satoh <junichi@rworks.jp>
+
+	* lib/PandoraFMS/Core.pm: Fixed the problem that agent status(estado)
+	is never updated to $new_status if initial state of new agent is
+	"estado != last_status" with "$new_status == last_status".
+	eg) When new agents are added by recontask, estado=1 and last_status=0
+	are set.
+
 2010-04-04  Sancho Lerena <slerena@artica.es>
 
 	* conf/pandora_server.conf: Some "fixed" descriptions and sample
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index f633792bec..b0ac504749 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -730,7 +730,7 @@ sub pandora_process_module ($$$$$$$$$;$) {
 		$status_changes = 0;
 	}
 
-	if ($status_changes == $module->{'min_ff_event'}) {
+	if ($status_changes >= $module->{'min_ff_event'}) {
 		generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $dbh);
 		$status = $new_status;
 	}