Merge branch '385-api_reports_no_data' into 'pandora_6.0'

Fixed api get module data. Ticket #385

See merge request !213
This commit is contained in:
vgilc 2017-02-27 15:37:03 +01:00
commit a2c4d4a2e0

View File

@ -5913,12 +5913,20 @@ function api_get_module_data($id, $thrash1, $other, $returnType) {
AND utimestamp < %d
ORDER BY utimestamp DESC", $id, $date_start, $date_end);
}
else {
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';
$data['list_index'] = array('utimestamp', 'datos');