Skip to content

Commit

Permalink
fix(selectfield): show contact field
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed May 9, 2023
1 parent 83ea716 commit 11c86b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
12 changes: 0 additions & 12 deletions inc/field/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,6 @@ public function buildParams($rand = null) {
}
}

$emptyItem = new $itemtype();
$emptyItem->getEmpty();
if (isset($emptyItem->fields['serial'])) {
$dparams['displaywith'][] = 'serial';
}
if (isset($emptyItem->fields['otherserial'])) {
$dparams['displaywith'][] = 'otherserial';
}
if ($itemtype === Ticket::class && !array_search('id', $dparams['displaywith'])) {
$dparams['displaywith'][] = 'id';
}

return $dparams;
}

Expand Down
22 changes: 22 additions & 0 deletions inc/field/glpiselectfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,28 @@ public function getAvailableValues(): array {
return [];
}

public function buildParams($rand = null) {
$dparams = parent::buildParams($rand);
$itemtype = $this->getSubItemtype();

$emptyItem = new $itemtype();
$emptyItem->getEmpty();
if (isset($emptyItem->fields['contact'])) {
$dparams['displaywith'][] = 'contact';
}
if (isset($emptyItem->fields['serial'])) {
$dparams['displaywith'][] = 'serial';
}
if (isset($emptyItem->fields['otherserial'])) {
$dparams['displaywith'][] = 'otherserial';
}
if ($itemtype === Ticket::class && !array_search('id', $dparams['displaywith'])) {
$dparams['displaywith'][] = 'id';
}

return $dparams;
}

public function equals($value): bool {
$value = html_entity_decode($value);
$itemtype = $this->getSubItemtype();
Expand Down

0 comments on commit 11c86b7

Please sign in to comment.