From b26e619bb92aa3bbb7209f565695c4291c1ed43b Mon Sep 17 00:00:00 2001
From: zarzuelo <noreply@pandorafms.org>
Date: Thu, 26 Apr 2012 13:31:53 +0000
Subject: [PATCH] 2012-04-26  Sergio Martin <sergio.martin@artica.es>

	* lib/PandoraFMS/Core.pm: Added call to delete the agent
	related nodes of the network map enterprise



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

diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog
index 0da93ccbd8..3e1e3489c4 100644
--- a/pandora_server/ChangeLog
+++ b/pandora_server/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-26  Sergio Martin <sergio.martin@artica.es>
+
+	* lib/PandoraFMS/Core.pm: Added call to delete the agent
+	related nodes of the network map enterprise
+
 2012-04-23  Ramon Novoa  <rnovoa@artica.es>
 
 	* lib/PandoraFMS/Core.pm: Merged from 4.0 branch. Do not insert zeroes
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index c8a65902d7..903f0e0383 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -1543,6 +1543,9 @@ sub pandora_delete_agent ($$;$) {
 	foreach my $module (@modules) {
 			pandora_delete_module ($dbh, $module->{'id_agente_modulo'});
 	}
+	
+	# Delete all the associated nodes of networkmap enterprise, if exist
+	enterprise_hook('pandora_delete_networkmap_enterprise_agents', [$dbh,$agent_id]);
 }
 
 ##########################################################################