Skip to content

Commit

Permalink
refactor: remove back compatibility with GLPI < 9.5.5
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Jul 22, 2021
1 parent 1c28934 commit 671fd3c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions inc/field/actorfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ public function getRenderedHtml($domain, $canEdit = true): string {
'itemtype' => User::getType(),
'values' => array_keys($value),
'valuesnames' => array_values($value),
'_idor_token' => Session::getNewIDORToken(User::getType()),
];
if (version_compare(GLPI_VERSION, '9.5.3') >= 0) {
$params['_idor_token'] = Session::getNewIDORToken(User::getType());
}
$html .= \PluginFormcreatorCommon::jsAjaxDropdown(
$fieldName . '[]',
$domId,
Expand Down
4 changes: 1 addition & 3 deletions inc/field/dropdownfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,7 @@ public function getRenderedHtml($domain, $canEdit = true): string {
if (!empty($this->question->fields['values'])) {
$dparams = $this->buildParams($rand);
$dparams['display'] = false;
if (version_compare(GLPI_VERSION, '9.5.3') >= 0) {
$params['_idor_token'] = Session::getNewIDORToken($itemtype);
}
$dparams['_idor_token'] = Session::getNewIDORToken($itemtype);
$html .= $itemtype::dropdown($dparams);
}
$html .= PHP_EOL;
Expand Down
8 changes: 2 additions & 6 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,8 @@ public function showForm($ID, $options = []) {
'values' => array_keys($selectedValidatorUsers),
'valuesnames' => array_values($selectedValidatorUsers),
'condition' => Dropdown::addNewCondition($usersCondition),
'_idor_token' => Session::getNewIDORToken(User::getType()),
];
if (version_compare(GLPI_VERSION, '9.5.3') >= 0) {
$params['_idor_token'] = Session::getNewIDORToken(User::getType());
}
echo Html::jsAjaxDropdown(
'_validator_users[]',
'_validator_users' . mt_rand(),
Expand Down Expand Up @@ -635,10 +633,8 @@ public function showForm($ID, $options = []) {
'valuesnames' => array_values($selectecValidatorGroups),
'condition' => Dropdown::addNewCondition($groupsCondition),
'display_emptychoice' => false,
'_idor_token' => Session::getNewIDORToken(Group::getType()),
];
if (version_compare(GLPI_VERSION, '9.5.3') >= 0) {
$params['_idor_token'] = Session::getNewIDORToken(Group::getType());
}
echo Html::jsAjaxDropdown(
'_validator_groups[]',
'_validator_groups' . mt_rand(),
Expand Down

0 comments on commit 671fd3c

Please sign in to comment.