From 6d3cb8ebc31b8f5c6c7f4e321abdc896382a63ff Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 27 Feb 2017 14:58:40 +0100 Subject: [PATCH] Fixed api get module data. Ticket #385 (cherry picked from commit 938dc40f77802859111e24a51aee0241d6ac3424) --- pandora_console/include/functions_api.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 9c6a3d495e..71a436f08c 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -5914,10 +5914,18 @@ function api_get_module_data($id, $thrash1, $other, $returnType) { ORDER BY utimestamp DESC", $id, $date_start, $date_end); } else { - $sql = sprintf ("SELECT utimestamp, datos - FROM tagente_datos - WHERE id_agente_modulo = %d AND utimestamp > %d - ORDER BY utimestamp DESC", $id, get_system_time () - $periodSeconds); + if ($periodSeconds == null) { + $sql = sprintf ("SELECT utimestamp, datos + FROM tagente_datos + WHERE id_agente_modulo = %d + ORDER BY utimestamp DESC", $id); + } + else { + $sql = sprintf ("SELECT utimestamp, datos + FROM tagente_datos + WHERE id_agente_modulo = %d AND utimestamp > %d + ORDER BY utimestamp DESC", $id, get_system_time () - $periodSeconds); + } } $data['type'] = 'array';