From 25175ce22e8bf4486d735e988b5d11ae876d4a10 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 5 Sep 2023 13:05:12 +0200 Subject: [PATCH] #11537 Fix inventory --- pandora_console/include/functions_inventory.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index aac94a9b52..0becb94fec 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -77,6 +77,8 @@ function inventory_get_data( } if ($inventory_search_string != '') { + hd(1, true); + hd($inventory_search_string, true); array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'"); } @@ -746,7 +748,9 @@ function inventory_get_datatable( } if ($inventory_search_string != '') { - array_push($where, "REPLACE(tagent_module_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'"); + hd(2, true); + hd($inventory_search_string, true); + array_push($where, "REPLACE(tagente_datos_inventory.data, ' ', ' ') LIKE '%".$inventory_search_string."%'"); } if ($utimestamp > 0) { @@ -786,7 +790,6 @@ function inventory_get_datatable( } $rows = db_get_all_rows_sql($sql); - if ($order_by_agent === false) { $modules = []; foreach ($rows as $row) { @@ -796,7 +799,7 @@ function inventory_get_datatable( $data_rows = explode(PHP_EOL, $row['data_inventory']); foreach ($data_rows as $data_key => $data_value) { - if (empty($data_value) === false) { + if (empty($data_value) === false && strpos(str_replace(' ', ' ', $data_value), $inventory_search_string)) { $row['data'] = $data_value; $modules[$row['name']][$row['name_agent'].'-'.$data_key.'-'.$data_value] = $row; } @@ -892,6 +895,8 @@ function get_data_basic_info_sql($params, $count=false) ' AND ( REPLACE(alias, " ", " ") LIKE "%%%s%%" )', $params['search'] ); + hd(3, true); + hd($params['search'], true); } if ($params['utimestamp'] > 0 && $count === false) {