From 497494ed3907b773f4a1c0890ca9edf26a0f3510 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:23:17 +0100 Subject: [PATCH 1/3] 1.0.5 --- CHANGELOG.md | 5 ++++- databaseinventory.xml | 5 +++++ setup.php | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf9647e..ea91521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [UNRELEASE] -### Fixed +## [1.0.5] - 2025-11-25 + +### Fixed +- Migrate dynamic group search from serialized to JSON format - Fix `Undefined array key "id"` when computer not already linkedo agent ## [1.0.4] - 2025-09-04 diff --git a/databaseinventory.xml b/databaseinventory.xml index f67344c..5acdd7c 100644 --- a/databaseinventory.xml +++ b/databaseinventory.xml @@ -26,6 +26,11 @@ ~11.0.0 https://github.com/pluginsGLPI/databaseinventory/releases/download/1.1.0/glpi-databaseinventory-1.1.0.tar.bz2 + + 1.0.5 + ~10.0.0 + https://github.com/pluginsGLPI/databaseinventory/releases/download/1.0.5/glpi-databaseinventory-1.0.5.tar.bz2 + 1.0.4 ~10.0.0 diff --git a/setup.php b/setup.php index 88b5d90..f143e66 100644 --- a/setup.php +++ b/setup.php @@ -28,7 +28,7 @@ * ------------------------------------------------------------------------- */ -define('PLUGIN_DATABASEINVENTORY_VERSION', '1.0.4'); +define('PLUGIN_DATABASEINVENTORY_VERSION', '1.0.5'); // Minimal GLPI version, inclusive define('PLUGIN_DATABASEINVENTORY_MIN_GLPI', '10.0.0'); From d55e9e60ac39b8297b733890c53cc925fbcf734d Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:33:38 +0100 Subject: [PATCH 2/3] fix CS --- inc/computergroupdynamic.class.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 5525933..1a40e52 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -90,8 +90,9 @@ public static function getSpecificValueToDisplay($field, $values, array $options $value = ' '; $out = ' '; if (strpos($values['id'], Search::NULLVALUE) === false) { - $search_params = Search::manageParams('Computer', - json_decode($values['search'], true, 512, JSON_THROW_ON_ERROR) + $search_params = Search::manageParams( + 'Computer', + json_decode($values['search'], true, 512, JSON_THROW_ON_ERROR), ); $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); @@ -160,8 +161,9 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $ private function countDynamicItems() { - $search_params = Search::manageParams('Computer', - json_decode($this->fields['search'], true, 512, JSON_THROW_ON_ERROR) + $search_params = Search::manageParams( + 'Computer', + json_decode($this->fields['search'], true, 512, JSON_THROW_ON_ERROR), ); $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); @@ -212,8 +214,9 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput 'plugin_databaseinventory_computergroups_id' => $ID, ]) ) { - $p = Search::manageParams('Computer', - json_decode($computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR) + $p = Search::manageParams( + 'Computer', + json_decode($computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR), ); $firsttime = false; } else { @@ -301,7 +304,7 @@ public static function install(Migration $migration) } } catch (Throwable $e) { $migration->displayMessage( - "DatabaseInventory - Invalid serialized data for DynamicGroup ID {$id}, data will be reset." + "DatabaseInventory - Invalid serialized data for DynamicGroup ID {$id}, data will be reset.", ); continue; } @@ -309,7 +312,7 @@ public static function install(Migration $migration) $DB->update( $table, ['search' => $json_search], - ['id' => $id] + ['id' => $id], ); } } From 9db566be59527d6a6551440c7c83d602b6bc1bbc Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:37:53 +0100 Subject: [PATCH 3/3] fix phstan --- front/computergroup.form.php | 1 - inc/computergroupdynamic.class.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/front/computergroup.form.php b/front/computergroup.form.php index 85d6ba6..83e93b4 100644 --- a/front/computergroup.form.php +++ b/front/computergroup.form.php @@ -119,7 +119,6 @@ if (isset($_GET['save'])) { $input = ['plugin_databaseinventory_computergroups_id' => $_GET['plugin_databaseinventory_computergroups_id']]; $search = json_encode([ - 'is_deleted' => $_GET['is_deleted'] ?? 0, 'is_deleted' => isset($_GET['is_deleted']) ? $_GET['is_deleted'] : 0 , 'as_map' => isset($_GET['as_map']) ? $_GET['as_map'] : 0, 'criteria' => $_GET['criteria'], diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 1a40e52..267d60d 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -214,7 +214,7 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput 'plugin_databaseinventory_computergroups_id' => $ID, ]) ) { - $p = Search::manageParams( + $p = $search_params = Search::manageParams( 'Computer', json_decode($computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR), );