Skip to content

Commit 11c86b7

Browse files
committed
fix(selectfield): show contact field
1 parent 83ea716 commit 11c86b7

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

inc/field/dropdownfield.class.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,6 @@ public function buildParams($rand = null) {
352352
}
353353
}
354354

355-
$emptyItem = new $itemtype();
356-
$emptyItem->getEmpty();
357-
if (isset($emptyItem->fields['serial'])) {
358-
$dparams['displaywith'][] = 'serial';
359-
}
360-
if (isset($emptyItem->fields['otherserial'])) {
361-
$dparams['displaywith'][] = 'otherserial';
362-
}
363-
if ($itemtype === Ticket::class && !array_search('id', $dparams['displaywith'])) {
364-
$dparams['displaywith'][] = 'id';
365-
}
366-
367355
return $dparams;
368356
}
369357

inc/field/glpiselectfield.class.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,28 @@ public function getAvailableValues(): array {
134134
return [];
135135
}
136136

137+
public function buildParams($rand = null) {
138+
$dparams = parent::buildParams($rand);
139+
$itemtype = $this->getSubItemtype();
140+
141+
$emptyItem = new $itemtype();
142+
$emptyItem->getEmpty();
143+
if (isset($emptyItem->fields['contact'])) {
144+
$dparams['displaywith'][] = 'contact';
145+
}
146+
if (isset($emptyItem->fields['serial'])) {
147+
$dparams['displaywith'][] = 'serial';
148+
}
149+
if (isset($emptyItem->fields['otherserial'])) {
150+
$dparams['displaywith'][] = 'otherserial';
151+
}
152+
if ($itemtype === Ticket::class && !array_search('id', $dparams['displaywith'])) {
153+
$dparams['displaywith'][] = 'id';
154+
}
155+
156+
return $dparams;
157+
}
158+
137159
public function equals($value): bool {
138160
$value = html_entity_decode($value);
139161
$itemtype = $this->getSubItemtype();

0 commit comments

Comments
 (0)