Skip to content

Commit ffd55e1

Browse files
authored
1.1.2 (#93)
* 1.1.2 * adapt changelog * adapt changelog * reorder version * fix CS * fix phstan * fix CS
1 parent 08c7055 commit ffd55e1

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,19 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [UNRELEASED]
99

10+
## [1.1.2] - 2025-11-25
11+
1012
### Fixed
1113

12-
- Fix dynamic group submit bouton
14+
- Migrate dynamic group search from serialized to JSON format
15+
- Fix dynamic group submit button
16+
17+
## [1.0.5] - 2025-11-25
18+
19+
### Fixed
20+
21+
- Migrate dynamic group search from serialized to JSON format
22+
- Fix `Undefined array key "id"` when computer not already linkedo agent
1323

1424
## [1.1.1] - 2025-11-13
1525

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

2434
- GLPI 11 compatibility
2535

36+
2637
### Fixed
2738

2839
- Fix `Undefined array key "id"` when computer not already linkedo agent

databaseinventory.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
<author>Teclib'</author>
2222
</authors>
2323
<versions>
24+
<version>
25+
<num>1.1.2</num>
26+
<compatibility>~11.0.0</compatibility>
27+
<download_url>https://github.com/pluginsGLPI/databaseinventory/releases/download/1.1.2/glpi-databaseinventory-1.1.2.tar.bz2</download_url>
28+
</version>
29+
<version>
30+
<num>1.0.5</num>
31+
<compatibility>~10.0.0</compatibility>
32+
<download_url>https://github.com/pluginsGLPI/databaseinventory/releases/download/1.0.5/glpi-databaseinventory-1.0.5.tar.bz2</download_url>
33+
</version>
2434
<version>
2535
<num>1.1.1</num>
2636
<compatibility>~11.0.0</compatibility>

inc/computergroup.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function countDynamicItem()
199199

200200
$iterator = $DB->request($params);
201201
foreach ($iterator as $computergroup_dynamic) {
202-
$search_params = Search::manageParams('Computer', json_decode($computergroup_dynamic['search'], true, 512, JSON_THROW_ON_ERROR));
202+
$search_params = Search::manageParams('Computer', json_decode((string) $computergroup_dynamic['search'], true, 512, JSON_THROW_ON_ERROR));
203203
$data = Search::prepareDatasForSearch('Computer', $search_params);
204204
Search::constructSQL($data);
205205
Search::constructData($data);

inc/computergroupdynamic.class.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
* -------------------------------------------------------------------------
2929
*/
3030

31+
use function Safe\json_decode;
32+
use function Safe\json_encode;
3133
use function Safe\ob_start;
3234
use function Safe\ob_get_clean;
3335
use function Safe\preg_match;
@@ -95,8 +97,9 @@ public static function getSpecificValueToDisplay($field, $values, array $options
9597
$value = ' ';
9698
$out = ' ';
9799
if (!str_contains((string) $values['id'], Search::NULLVALUE)) {
98-
$search_params = Search::manageParams('Computer',
99-
json_decode($values['search'], true, 512, JSON_THROW_ON_ERROR)
100+
$search_params = Search::manageParams(
101+
'Computer',
102+
json_decode((string) $values['search'], true, 512, JSON_THROW_ON_ERROR),
100103
);
101104

102105

@@ -164,8 +167,9 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
164167

165168
private function countDynamicItems()
166169
{
167-
$search_params = Search::manageParams('Computer',
168-
json_decode($this->fields['search'], true, 512, JSON_THROW_ON_ERROR)
170+
$search_params = Search::manageParams(
171+
'Computer',
172+
json_decode((string) $this->fields['search'], true, 512, JSON_THROW_ON_ERROR),
169173
);
170174

171175
$data = Search::prepareDatasForSearch('Computer', $search_params);
@@ -178,7 +182,7 @@ private function countDynamicItems()
178182
public function isDynamicSearchMatchComputer(Computer $computer)
179183
{
180184
// add new criteria to force computer ID
181-
$search = json_decode($this->fields['search']);
185+
$search = json_decode((string) $this->fields['search']);
182186

183187
$search['criteria'][] = [
184188
'link' => 'AND',
@@ -214,8 +218,9 @@ private static function showForItem(PluginDatabaseinventoryComputerGroup $comput
214218
if ($computergroup_dynamic->getFromDBByCrit([
215219
'plugin_databaseinventory_computergroups_id' => $ID,
216220
])) {
217-
$p = Search::manageParams('Computer',
218-
json_decode($computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR)
221+
$p = Search::manageParams(
222+
'Computer',
223+
json_decode((string) $computergroup_dynamic->fields['search'], true, 512, JSON_THROW_ON_ERROR),
219224
);
220225

221226
$search_params = $p;
@@ -310,17 +315,17 @@ public static function install(Migration $migration)
310315
if ($unserialized !== false) {
311316
$json_search = json_encode($unserialized, JSON_THROW_ON_ERROR);
312317
}
313-
} catch (Throwable $e) {
318+
} catch (Throwable) {
314319
$migration->displayMessage(
315-
"DatabaseInventory - Invalid serialized data for DynamicGroup ID {$id}, data will be reset."
320+
sprintf('DatabaseInventory - Invalid serialized data for DynamicGroup ID %s, data will be reset.', $id),
316321
);
317322
continue;
318323
}
319324

320325
$DB->update(
321326
$table,
322327
['search' => $json_search],
323-
['id' => $id]
328+
['id' => $id],
324329
);
325330
}
326331

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
use function Safe\define;
3232

33-
define('PLUGIN_DATABASEINVENTORY_VERSION', '1.1.1');
33+
define('PLUGIN_DATABASEINVENTORY_VERSION', '1.1.2');
3434
// Minimal GLPI version, inclusive
3535
define('PLUGIN_DATABASEINVENTORY_MIN_GLPI', '11.0.0');
3636
// Maximum GLPI version, exclusive

0 commit comments

Comments
 (0)