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

- Fix item creation with null value for mandatory fields
- Fix search crash when two containers share a dropdown field with the same name.
- Fix handle native GLPI dropdown types when binding additional fields to form destination

## [1.24.2] - 2026-06-30

Expand Down
4 changes: 2 additions & 2 deletions inc/destinationfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public function applyConfiguratedValueToInputUsingAnswers(
if ($field->fields['type'] == 'glpi_item') {
$input[sprintf('itemtype_%s', $field_name)] = $answer->getRawAnswer()['itemtype'];
$input[sprintf('items_id_%s', $field_name)] = $answer->getRawAnswer()['items_id'];
} elseif ($field->fields['type'] == 'dropdown') {
$raw_id = (int) $answer->getRawAnswer()['items_id'];
} elseif (str_starts_with((string) $field->fields['type'], 'dropdown')) {
$raw_id = (int) ($answer->getRawAnswer()['items_id'] ?? 0);
$input[$field_name] = ($raw_id > 0) ? $raw_id : null;
} else {
$input[$field_name] = $value ?? $answer->getRawAnswer();
Expand Down
2 changes: 1 addition & 1 deletion inc/questiontype.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function formatRawAnswer(mixed $answer, Question $question): string

$names = [];
foreach ($answer as $items_id) {
$item = $itemtype::getById($items_id);
$item = $itemtype::getById((int) $items_id);
if ($item) {
$names[] = $item->fields['name'];
}
Expand Down
7 changes: 6 additions & 1 deletion tests/Units/FieldDestinationFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ public function testDestinationWithLocationAdditonalFields(): void
form: $form,
config: new SimpleValueConfig(1),
answers: [
"Location Field" => $location->getID(),
// The end user template submits dropdowns as an array
// containing the selected itemtype and items_id.
"Location Field" => [
'itemtype' => Location::class,
'items_id' => $location->getID(),
],
],
expected_field_values: [
Ticket::class => [
Expand Down