Skip to content

Commit

Permalink
fix(glpiobject,dropdown): formanswer must display name, not the ID
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Mar 6, 2019
1 parent eec8012 commit db24ae9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion inc/fields/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,19 @@ public function displayField($canEdit = true) {
pluginFormcreatorInitializeDropdown('$fieldName', '$rand');
});");
} else {
echo $this->value;
$decodedValues = json_decode($this->fields['values'], JSON_OBJECT_AS_ARRAY);
if ($decodedValues === null) {
$itemtype = $this->fields['values'];
} else {
$itemtype = $decodedValues['itemtype'];
}
$item = new $itemtype();
$value = '';
if ($item->getFromDB($this->value)) {
$value = $item->getField('name');
}

echo $value;
}
}

Expand Down

0 comments on commit db24ae9

Please sign in to comment.