mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
#10851 Fix inventory date filter and last update query
This commit is contained in:
parent
cccb03010c
commit
bd453ea1de
@ -707,6 +707,17 @@ function inventory_get_datatable(
|
|||||||
) {
|
) {
|
||||||
global $config;
|
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');
|
$offset = (int) get_parameter('offset');
|
||||||
|
|
||||||
$where = [];
|
$where = [];
|
||||||
@ -742,7 +753,7 @@ function inventory_get_datatable(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($utimestamp > 0) {
|
if ($utimestamp > 0) {
|
||||||
array_push($where, 'tagente_datos_inventory.utimestamp <= '.$utimestamp.' ');
|
array_push($where, 'tagente_datos_inventory.utimestamp = '.$utimestamp.' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
@ -768,8 +779,6 @@ function inventory_get_datatable(
|
|||||||
$config['block_size']
|
$config['block_size']
|
||||||
);
|
);
|
||||||
|
|
||||||
hd($sql, true);
|
|
||||||
|
|
||||||
$rows = db_get_all_rows_sql($sql);
|
$rows = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if ($order_by_agent === false) {
|
if ($order_by_agent === false) {
|
||||||
@ -797,16 +806,17 @@ function inventory_get_datatable(
|
|||||||
$agent_data[$row['id_agente']][] = $row;
|
$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'];
|
$rows_tmp['agent'] = $row['name_agent'];
|
||||||
foreach ($rows as $row) {
|
foreach ($data_rows as $row) {
|
||||||
if ($utimestamp > 0) {
|
if ($utimestamp > 0) {
|
||||||
$data_row = db_get_row_sql(
|
$data_row = db_get_row_sql(
|
||||||
sprintf(
|
sprintf(
|
||||||
'SELECT `data`,
|
'SELECT `data`,
|
||||||
`timestamp`
|
`timestamp`,
|
||||||
|
`utimestamp`
|
||||||
FROM tagente_datos_inventory
|
FROM tagente_datos_inventory
|
||||||
WHERE utimestamp <= "%s"
|
WHERE utimestamp = "%s"
|
||||||
AND id_agent_module_inventory = %d
|
AND id_agent_module_inventory = %d
|
||||||
ORDER BY utimestamp DESC',
|
ORDER BY utimestamp DESC',
|
||||||
$utimestamp,
|
$utimestamp,
|
||||||
@ -817,12 +827,14 @@ function inventory_get_datatable(
|
|||||||
if ($data_row !== false) {
|
if ($data_row !== false) {
|
||||||
$row['data'] = $data_row['data'];
|
$row['data'] = $data_row['data'];
|
||||||
$row['timestamp'] = $data_row['timestamp'];
|
$row['timestamp'] = $data_row['timestamp'];
|
||||||
|
$row['utimestamp'] = $data_row['utimestamp'];
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rows[0]['timestamp'] = $row['timestamp'];
|
||||||
$rows_tmp['row'] = $rows;
|
$rows_tmp['row'] = $rows;
|
||||||
array_push($agents_rows, $rows_tmp);
|
array_push($agents_rows, $rows_tmp);
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ if (is_metaconsole() === false) {
|
|||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
false,
|
||||||
'',
|
'',
|
||||||
false,
|
false,
|
||||||
'width:100%;'
|
'width:100%;'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user