From 796bf1488bad6c02ba30dfccd9e357968747ff54 Mon Sep 17 00:00:00 2001
From: javilanz <noreply@pandorafms.org>
Date: Fri, 12 Aug 2011 08:04:07 +0000
Subject: [PATCH] 2011-08-12 Javier Lanz <javier.lanz@artica.es>

        * operation/agentes/exportdata.php: Fixed calculating process to get
        module data within a period.

        Fixes: #3389996



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4723 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                        | 7 +++++++
 pandora_console/operation/agentes/exportdata.php | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 4a4420132d..a94b5ce24f 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-12 Javier Lanz <javier.lanz@artica.es>
+
+	* operation/agentes/exportdata.php: Fixed calculating process to get
+	module data within a period.
+
+	Fixes: #3389996
+
 2011-08-11  Sergio Martin <sergio.martin@artica.es>
 
 	* include/config_process.php
diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php
index 8b887d8adf..8be3425a2c 100644
--- a/pandora_console/operation/agentes/exportdata.php
+++ b/pandora_console/operation/agentes/exportdata.php
@@ -211,7 +211,6 @@ if (!empty ($export_btn) && !empty ($module)) {
 				//Buffer to get data, anyway this will report a memory exhaustin
 
 				while ($work_end <= $end) {
-					$work_end = $work_end + $work_period;
 
 					$data = array (); // Reinitialize array for each module chunk
 					if ($export_type == "avg") {
@@ -265,6 +264,7 @@ if (!empty ($export_btn) && !empty ($module)) {
 					$output = "";
 					unset($data);
 					unset($data_single);
+					$work_end = $work_end + $work_period;
 				}
 			unset ($output);
 			$output = "";