Skip to content

Commit

Permalink
Fix Entity dropdown using "multiple" option (#12717)
Browse files Browse the repository at this point in the history
* Added parenthesis to fix this error which occurs when creating an Entity multiple choice dropdown: "Uncaught Exception TypeError: array_combine(): Argument #2 ($values) must be of type array, null given in glpi10.0.3/src/Html.php at line 4857"
Added Dropdown::testShow to unit test multiple choice dropdown creation on Entity's itemtype

* Remove unmaintainable test.

* More readable

Co-authored-by: Cédric Anne <[email protected]>
  • Loading branch information
Aeto-J and cedric-anne authored Sep 26, 2022
1 parent d1f6316 commit 8de64a8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ public static function show($itemtype, $options = [])
$name = $params['toadd'][$params['value']];
} else if (
!$params['multiple']
&& $params['value'] > 0
|| ($itemtype == "Entity" && $params['value'] >= 0)
&& ($params['value'] > 0 || ($itemtype == "Entity" && $params['value'] >= 0))
) {
$tmpname = self::getDropdownName($table, $params['value'], 1);

Expand Down

0 comments on commit 8de64a8

Please sign in to comment.