From 7ceea00dde64c8b2bf2eaa288435524dd2ba770f Mon Sep 17 00:00:00 2001 From: alisher372 Date: Fri, 31 Jul 2026 16:48:06 +0500 Subject: [PATCH] Update TableQuestion.php --- src/Model/QuestionType/TableQuestion.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Model/QuestionType/TableQuestion.php b/src/Model/QuestionType/TableQuestion.php index 84889cf..5fc3fd0 100644 --- a/src/Model/QuestionType/TableQuestion.php +++ b/src/Model/QuestionType/TableQuestion.php @@ -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; @@ -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; }