Skip to content

Commit 9fd2bef

Browse files
committed
fix(glpiselectfield): search itemtype in wrong locatin
data migrated to own column
1 parent 6731ae2 commit 9fd2bef

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

inc/field/dropdownfield.class.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -914,22 +914,6 @@ public function getSubItemtype() {
914914
return $this->question->fields['itemtype'];
915915
}
916916

917-
/**
918-
* Get the itemtype of the item to show for the given values
919-
*
920-
* @param string $values json or raw string
921-
*
922-
* @return string
923-
*/
924-
public static function getSubItemtypeForValues($values) {
925-
$decodedValues = json_decode($values, JSON_OBJECT_AS_ARRAY);
926-
if ($decodedValues === null) {
927-
return $values;
928-
}
929-
930-
return $decodedValues['itemtype'];
931-
}
932-
933917
/**
934918
* get HTML code to show entity restriction policy
935919
* @return string HTML code

inc/field/glpiselectfield.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function getAvailableValues(): array {
212212

213213
public function equals($value): bool {
214214
$value = html_entity_decode($value);
215-
$itemtype = $this->getSubItemtypeForValues($this->question->fields['values']);
215+
$itemtype = $this->getSubItemtype();
216216
$item = new $itemtype();
217217
if ($item->isNewId($this->value)) {
218218
return ($value === '');
@@ -229,7 +229,7 @@ public function notEquals($value): bool {
229229

230230
public function greaterThan($value): bool {
231231
$value = html_entity_decode($value);
232-
$itemtype = $this->getSubItemtypeForValues($this->question->fields['values']);
232+
$itemtype = $this->getSubItemtype();
233233
$item = new $itemtype();
234234
if (!$item->getFromDB($this->value)) {
235235
throw new ComparisonException('Item not found for comparison');

0 commit comments

Comments
 (0)