From 76346daf11f7f612ee71740a9cbc5f5729dadc6c Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 20 Jun 2023 11:00:09 +0200 Subject: [PATCH] #11579 Fix inventory --- .../include/functions_inventory.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index ba09ddd62f..34ddd65277 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -742,7 +742,7 @@ function inventory_get_datatable( } if ($utimestamp > 0) { - array_push($where, 'tagente_datos_inventory.utimestamp = '.$utimestamp.' '); + array_push($where, 'tagente_datos_inventory.utimestamp <= '.$utimestamp.' '); } $sql = sprintf( @@ -761,13 +761,22 @@ function inventory_get_datatable( ON tagente.id_agente = tagent_module_inventory.id_agente WHERE %s - ORDER BY tmodule_inventory.id_module_inventory - LIMIT %d, %d', - implode(' AND ', $where), - $offset, - $config['block_size'] + ORDER BY tmodule_inventory.id_module_inventory + ', + implode(' AND ', $where) ); + if ($inventory_module_name[0] !== '0' + && $inventory_module_name !== '' + && $inventory_module_name !== 'all' + ) { + $sql .= sprintf( + 'LIMIT %d, %d', + $offset, + $config['block_size'] + ); + } + $rows = db_get_all_rows_sql($sql); if ($order_by_agent === false) {