From 51928bb4cbcd176b4be40068019d58a28780ce05 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:22:02 +0100 Subject: [PATCH 1/7] 1.1.2 --- CHANGELOG.md | 3 +++ databaseinventory.xml | 10 ++++++++++ setup.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b77386..90962e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [UNRELEASED] +## [1.1.2] - 2025-11-25 + ### Fixed +- Migrate dynamic group search from serialized to JSON format - Fix dynamic group submit bouton ## [1.1.1] - 2025-11-13 diff --git a/databaseinventory.xml b/databaseinventory.xml index 08b363e..7f96ae3 100644 --- a/databaseinventory.xml +++ b/databaseinventory.xml @@ -21,6 +21,11 @@ Teclib' + + 1.1.2 + ~11.0.0 + https://github.com/pluginsGLPI/databaseinventory/releases/download/1.1.2/glpi-databaseinventory-1.1.2.tar.bz2 + 1.1.1 ~11.0.0 @@ -31,6 +36,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 41cd064..43bbc5d 100644 --- a/setup.php +++ b/setup.php @@ -30,7 +30,7 @@ use function Safe\define; -define('PLUGIN_DATABASEINVENTORY_VERSION', '1.1.1'); +define('PLUGIN_DATABASEINVENTORY_VERSION', '1.1.2'); // Minimal GLPI version, inclusive define('PLUGIN_DATABASEINVENTORY_MIN_GLPI', '11.0.0'); // Maximum GLPI version, exclusive From 198af28a57fc78b5f8f204b9c5489aa3f6a21862 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:23:49 +0100 Subject: [PATCH 2/7] adapt changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90962e1..2571190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - GLPI 11 compatibility +## [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 + ### Fixed - Fix `Undefined array key "id"` when computer not already linkedo agent From 186507ed32069e65d4db6529f3046b19ba72e189 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:24:54 +0100 Subject: [PATCH 3/7] adapt changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2571190..f69fc0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Migrate dynamic group search from serialized to JSON format -- Fix dynamic group submit bouton +- Fix dynamic group submit button ## [1.1.1] - 2025-11-13 From 2160af183a9513a94b31a1d3e94978fa4a7c2e5b Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:31:32 +0100 Subject: [PATCH 4/7] reorder version --- CHANGELOG.md | 13 +++++++------ databaseinventory.xml | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f69fc0f..769eac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Migrate dynamic group search from serialized to JSON format - Fix dynamic group submit button +## [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.1.1] - 2025-11-13 ### Fixed @@ -26,12 +33,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - GLPI 11 compatibility -## [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 ### Fixed diff --git a/databaseinventory.xml b/databaseinventory.xml index 7f96ae3..3228d85 100644 --- a/databaseinventory.xml +++ b/databaseinventory.xml @@ -26,6 +26,11 @@ ~11.0.0 https://github.com/pluginsGLPI/databaseinventory/releases/download/1.1.2/glpi-databaseinventory-1.1.2.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.1.1 ~11.0.0 @@ -36,11 +41,6 @@ ~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 From 7c7c75d1e4a18cfdf912e3cccbfd8a13f3744d89 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:32:32 +0100 Subject: [PATCH 5/7] fix CS --- inc/computergroup.class.php | 2 +- inc/computergroupdynamic.class.php | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/inc/computergroup.class.php b/inc/computergroup.class.php index fd5dd1f..cadb3f6 100644 --- a/inc/computergroup.class.php +++ b/inc/computergroup.class.php @@ -199,7 +199,7 @@ public function countDynamicItem() $iterator = $DB->request($params); foreach ($iterator as $computergroup_dynamic) { - $search_params = Search::manageParams('Computer', json_decode($computergroup_dynamic['search'], true, 512, JSON_THROW_ON_ERROR)); + $search_params = Search::manageParams('Computer', json_decode((string) $computergroup_dynamic['search'], true, 512, JSON_THROW_ON_ERROR)); $data = Search::prepareDatasForSearch('Computer', $search_params); Search::constructSQL($data); Search::constructData($data); diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 7e33df5..6083879 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -95,8 +95,9 @@ public static function getSpecificValueToDisplay($field, $values, array $options $value = ' '; $out = ' '; if (!str_contains((string) $values['id'], Search::NULLVALUE)) { - $search_params = Search::manageParams('Computer', - json_decode($values['search'], true, 512, JSON_THROW_ON_ERROR) + $search_params = Search::manageParams( + 'Computer', + json_decode((string) $values['search'], true, 512, JSON_THROW_ON_ERROR), ); @@ -164,8 +165,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((string) $this->fields['search'], true, 512, JSON_THROW_ON_ERROR), ); $data = Search::prepareDatasForSearch('Computer', $search_params); @@ -178,7 +180,7 @@ private function countDynamicItems() public function isDynamicSearchMatchComputer(Computer $computer) { // add new criteria to force computer ID - $search = json_decode($this->fields['search']); + $search = json_decode((string) $this->fields['search']); $search['criteria'][] = [ 'link' => 'AND', @@ -214,8 +216,9 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput if ($computergroup_dynamic->getFromDBByCrit([ '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((string) $computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR), ); $search_params = $p; @@ -310,9 +313,9 @@ public static function install(Migration $migration) if ($unserialized !== false) { $json_search = json_encode($unserialized, JSON_THROW_ON_ERROR); } - } catch (Throwable $e) { + } catch (Throwable) { $migration->displayMessage( - "DatabaseInventory - Invalid serialized data for DynamicGroup ID {$id}, data will be reset." + sprintf('DatabaseInventory - Invalid serialized data for DynamicGroup ID %s, data will be reset.', $id), ); continue; } @@ -320,7 +323,7 @@ public static function install(Migration $migration) $DB->update( $table, ['search' => $json_search], - ['id' => $id] + ['id' => $id], ); } From a1596ce8d31a3dc0f94e113b436a76ece914db65 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:38:56 +0100 Subject: [PATCH 6/7] fix phstan --- inc/computergroupdynamic.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 6083879..184359c 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -28,6 +28,7 @@ * ------------------------------------------------------------------------- */ +use function Safe\json_decode; use function Safe\ob_start; use function Safe\ob_get_clean; use function Safe\preg_match; From 65bc0a2a90b1668c0f350470324faca484ab1e16 Mon Sep 17 00:00:00 2001 From: Stanislas Kita Date: Tue, 25 Nov 2025 15:43:47 +0100 Subject: [PATCH 7/7] fix CS --- inc/computergroupdynamic.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 184359c..bb80312 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -29,6 +29,7 @@ */ use function Safe\json_decode; +use function Safe\json_encode; use function Safe\ob_start; use function Safe\ob_get_clean; use function Safe\preg_match;