Skip to content

Commit 67399a8

Browse files
committed
fix(dropdownfield,glpiselectfield): build parameters even when none in DB
1 parent aa92a2f commit 67399a8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

inc/field/dropdownfield.class.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public function buildParams($rand = null) {
150150
$dparams['right'] = 'all';
151151
$currentEntity = Session::getActiveEntity();
152152
$ancestorEntities = getAncestorsOf(Entity::getTable(), $currentEntity);
153+
$decodedValues['entity_restrict'] = $decodedValues['entity_restrict'] ?? 2;
153154
switch ($decodedValues['entity_restrict']) {
154155
case self::ENTITY_RESTRICT_FORM:
155156
$form = PluginFormcreatorForm::getByItem($this->getQuestion());
@@ -184,6 +185,7 @@ public function buildParams($rand = null) {
184185
if (Session::getCurrentInterface() == 'helpdesk') {
185186
$dparams_cond_crit['is_helpdeskvisible'] = 1;
186187
}
188+
$decodedValues['show_ticket_categories'] = $decodedValues['show_ticket_categories'] ?? 'all';
187189
switch ($decodedValues['show_ticket_categories']) {
188190
case 'request':
189191
$dparams_cond_crit['is_request'] = 1;
@@ -306,6 +308,7 @@ public function buildParams($rand = null) {
306308
$itemtype::getTable(),
307309
$decodedValues['show_tree_root']
308310
);
311+
$decodedValues['selectable_tree_root'] = $decodedValues['selectable_tree_root'] ?? '1';
309312
if (!isset($decodedValues['selectable_tree_root']) || $decodedValues['selectable_tree_root'] == '0') {
310313
unset($sons[$decodedValues['show_tree_root']]);
311314
}
@@ -372,9 +375,7 @@ public function getRenderedHtml($domain, $canEdit = true): string {
372375
$rand = mt_rand();
373376
$fieldName = 'formcreator_field_' . $id;
374377
$dparams = [];
375-
if (!empty($this->question->fields['values'])) {
376-
$dparams = $this->buildParams($rand);
377-
}
378+
$dparams = $this->buildParams($rand);
378379
$dparams['display'] = false;
379380
$dparams['_idor_token'] = Session::getNewIDORToken($itemtype);
380381
$html .= $itemtype::dropdown($dparams);

0 commit comments

Comments
 (0)