Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more convenient to sort by release date than by number.

Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [UNRELEASED]

## [1.1.2] - 2025-11-25

### Fixed

- Fix dynamic group submit bouton
- 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

Expand All @@ -23,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- GLPI 11 compatibility


### Fixed

- Fix `Undefined array key "id"` when computer not already linkedo agent
Expand Down
10 changes: 10 additions & 0 deletions databaseinventory.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
<author>Teclib'</author>
</authors>
<versions>
<version>
<num>1.1.2</num>
<compatibility>~11.0.0</compatibility>
<download_url>https://github.com/pluginsGLPI/databaseinventory/releases/download/1.1.2/glpi-databaseinventory-1.1.2.tar.bz2</download_url>
</version>
<version>
<num>1.0.5</num>
<compatibility>~10.0.0</compatibility>
<download_url>https://github.com/pluginsGLPI/databaseinventory/releases/download/1.0.5/glpi-databaseinventory-1.0.5.tar.bz2</download_url>
</version>
<version>
<num>1.1.1</num>
<compatibility>~11.0.0</compatibility>
Expand Down
2 changes: 1 addition & 1 deletion inc/computergroup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 15 additions & 10 deletions inc/computergroupdynamic.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* -------------------------------------------------------------------------
*/

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;
Expand Down Expand Up @@ -95,8 +97,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),
);


Expand Down Expand Up @@ -164,8 +167,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);
Expand All @@ -178,7 +182,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',
Expand Down Expand Up @@ -214,8 +218,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;
Expand Down Expand Up @@ -310,17 +315,17 @@ 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;
}

$DB->update(
$table,
['search' => $json_search],
['id' => $id]
['id' => $id],
);
}

Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down