#11579 Fix inventory table
This commit is contained in:
parent
779f9b93dc
commit
377b25f823
|
@ -707,17 +707,6 @@ 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 = [];
|
||||
|
@ -803,12 +792,29 @@ function inventory_get_datatable(
|
|||
$agent_data = [];
|
||||
$rows_tmp = [];
|
||||
foreach ($rows as $row) {
|
||||
$agent_data[$row['id_agente']][] = $row;
|
||||
$replace_agent_data = false;
|
||||
if (isset($agent_data[$row['id_agente']]) === true) {
|
||||
foreach ($agent_data[$row['id_agente']] as $key => $compare_data) {
|
||||
if ($compare_data['id_module_inventory'] === $row['id_module_inventory']
|
||||
&& $row['last_update'] > $compare_data['last_update']
|
||||
) {
|
||||
$agent_data[$row['id_agente']][$key] = $row;
|
||||
$replace_agent_data = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($replace_agent_data === false) {
|
||||
$agent_data[$row['id_agente']][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($agent_data as $id_agent => $data_agent) {
|
||||
$rows_tmp['agent'] = $data_agent['name_agent'];
|
||||
foreach ($data_agent as $key => $agent_row) {
|
||||
if (isset($rows_tmp['agent']) === false) {
|
||||
$rows_tmp['agent'] = $agent_row['name_agent'];
|
||||
}
|
||||
|
||||
$data_agent[$key]['timestamp'] = $agent_row['last_update_timestamp'];
|
||||
$data_agent[$key]['utimestamp'] = $agent_row['last_update'];
|
||||
|
||||
|
|
Loading…
Reference in New Issue