Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Add compatibility with GLPI `CustomAsset`

### Fixed

- Fix empty default value in multiple dropdown fields

## [1.23.2] - 2025-12-22

Expand Down
4 changes: 3 additions & 1 deletion inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
PRIMARY KEY (`id`),
KEY `entities_id` (`entities_id`)
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
if (!$DB->doQuery($query)) {

Check failure on line 100 in inc/container.class.php

View workflow job for this annotation

GitHub Actions / GLPI 11.0.x - php:8.2 - mariadb:10.6 / Continuous integration

Negated boolean expression is always false.

Check failure on line 100 in inc/container.class.php

View workflow job for this annotation

GitHub Actions / GLPI 11.0.x - php:8.5 - mariadb:11.8 / Continuous integration

Negated boolean expression is always false.
throw new RuntimeException('Error creating plugin_fields_containers table: ' . $DB->error());
}
}
Expand Down Expand Up @@ -1354,7 +1354,9 @@
$data[$field_name] = json_encode(array_values(array_unique(array_merge($existing_values, $new_values))));

} else {
$data[$field_name] = json_encode($data[$field_name]);
$value = $data[$field_name];
$value = is_array($value) ? $value : [];
$data[$field_name] = json_encode($value);
}
} elseif (array_key_exists('_' . $field_name . '_defined', $data)) {
$data[$field_name] = json_encode([]);
Expand Down
3 changes: 2 additions & 1 deletion inc/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
KEY `is_active` (`is_active`),
KEY `is_readonly` (`is_readonly`)
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
if (!$DB->doQuery($query)) {

Check failure on line 97 in inc/field.class.php

View workflow job for this annotation

GitHub Actions / GLPI 11.0.x - php:8.2 - mariadb:10.6 / Continuous integration

Negated boolean expression is always false.

Check failure on line 97 in inc/field.class.php

View workflow job for this annotation

GitHub Actions / GLPI 11.0.x - php:8.5 - mariadb:11.8 / Continuous integration

Negated boolean expression is always false.
throw new RuntimeException('Error creating plugin_fields_fields table: ' . $DB->error());
}
}
Expand Down Expand Up @@ -1278,7 +1278,8 @@
// - either from a previous input (it will be an array).
//
// -> Decode it only if it is not already an array.
$value = json_decode((string) $value);
$decoded = json_decode((string) $value, true);
$value = is_array($decoded) ? $decoded : [];
}

$field['value'] = $value;
Expand Down
Loading