Skip to content

Commit 9cfeea4

Browse files
committed
fix(glpiselectfield): cannot save conditions
1 parent a621468 commit 9cfeea4

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

inc/field/glpiselectfield.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function isValidValue($value): bool {
106106
}
107107

108108
public function prepareQuestionInputForSave($input) {
109-
if (!isset($input['itemtype']) || empty($input['itemtype'])) {
109+
if (isset($input['itemtype']) && empty($input['itemtype'])) {
110110
Session::addMessageAfterRedirect(
111111
__('The field value is required:', 'formcreator') . ' ' . $input['name'],
112112
false,
@@ -115,8 +115,7 @@ public function prepareQuestionInputForSave($input) {
115115
return [];
116116
}
117117

118-
$itemtype = $input['itemtype'];
119-
$input['itemtype'] = $itemtype;
118+
$itemtype = $input['itemtype'] ?? $this->getSubItemtype();
120119
$input['values'] = [];
121120
// Params for entity restrictables itemtypes
122121
$input['values']['entity_restrict'] = $input['entity_restrict'] ?? self::ENTITY_RESTRICT_FORM;

0 commit comments

Comments
 (0)