Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/Model/QuestionType/TableQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,22 @@ private function resolveItemNames(string $itemtype, array $values): array

global $DB;

$where = ['id' => $ids];

// GLPI 11 custom dropdown classes can share the same database table.
// Their system SQL criteria restrict rows to the current dropdown definition.
if (method_exists($itemtype, 'getSystemSQLCriteria')) {
$system_criteria = $itemtype::getSystemSQLCriteria();
if (is_array($system_criteria) && $system_criteria !== []) {
$where[] = $system_criteria;
}
}

$map = [];
foreach ($DB->request([
'SELECT' => ['id', 'name'],
'FROM' => $item->getTable(),
'WHERE' => ['id' => $ids],
'WHERE' => $where,
]) as $row) {
if (!is_array($row)) {
continue;
Expand Down Expand Up @@ -950,6 +961,15 @@ private function buildGlpiItemtypeOptions(string $itemtype): array

$where = [];

// GLPI 11 custom dropdown classes can share the same database table.
// Their system SQL criteria restrict rows to the current dropdown definition.
if (method_exists($itemtype, 'getSystemSQLCriteria')) {
$system_criteria = $itemtype::getSystemSQLCriteria();
if (is_array($system_criteria) && $system_criteria !== []) {
$where[] = $system_criteria;
}
}

if ($item->maybeDeleted()) {
$where['is_deleted'] = 0;
}
Expand Down