diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index 2430b69163..c91a375225 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -707,6 +707,17 @@ function inventory_get_datatable( ) { global $config; + if ($utimestamp === 0) { + $data_last = db_get_row_sql( + sprintf( + 'SELECT `utimestamp`, `timestamp` + FROM tagente_datos_inventory + ORDER BY utimestamp DESC' + ) + ); + $utimestamp = $data_last['utimestamp']; + } + $offset = (int) get_parameter('offset'); $where = []; @@ -742,7 +753,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( @@ -768,8 +779,6 @@ function inventory_get_datatable( $config['block_size'] ); - hd($sql, true); - $rows = db_get_all_rows_sql($sql); if ($order_by_agent === false) { @@ -797,16 +806,17 @@ function inventory_get_datatable( $agent_data[$row['id_agente']][] = $row; } - foreach ($agent_data as $id_agent => $rows) { + foreach ($agent_data as $id_agent => $data_rows) { $rows_tmp['agent'] = $row['name_agent']; - foreach ($rows as $row) { + foreach ($data_rows as $row) { if ($utimestamp > 0) { $data_row = db_get_row_sql( sprintf( 'SELECT `data`, - `timestamp` + `timestamp`, + `utimestamp` FROM tagente_datos_inventory - WHERE utimestamp <= "%s" + WHERE utimestamp = "%s" AND id_agent_module_inventory = %d ORDER BY utimestamp DESC', $utimestamp, @@ -817,12 +827,14 @@ function inventory_get_datatable( if ($data_row !== false) { $row['data'] = $data_row['data']; $row['timestamp'] = $data_row['timestamp']; + $row['utimestamp'] = $data_row['utimestamp']; } else { continue; } } } + $rows[0]['timestamp'] = $row['timestamp']; $rows_tmp['row'] = $rows; array_push($agents_rows, $rows_tmp); } diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php index ba45efe85a..fd30943e8d 100755 --- a/pandora_console/operation/inventory/inventory.php +++ b/pandora_console/operation/inventory/inventory.php @@ -690,7 +690,7 @@ if (is_metaconsole() === false) { 0, true, false, - true, + false, '', false, 'width:100%;'