From 671fd3c3ba76348c67a822a89644eba4cd39470c Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Thu, 22 Jul 2021 13:41:49 +0200 Subject: [PATCH] refactor: remove back compatibility with GLPI < 9.5.5 Signed-off-by: Thierry Bugier --- inc/field/actorfield.class.php | 4 +--- inc/field/dropdownfield.class.php | 4 +--- inc/form.class.php | 8 ++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/inc/field/actorfield.class.php b/inc/field/actorfield.class.php index a966e59d1..e9330a878 100644 --- a/inc/field/actorfield.class.php +++ b/inc/field/actorfield.class.php @@ -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, diff --git a/inc/field/dropdownfield.class.php b/inc/field/dropdownfield.class.php index 2d9fd25a5..7daa95c8c 100644 --- a/inc/field/dropdownfield.class.php +++ b/inc/field/dropdownfield.class.php @@ -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; diff --git a/inc/form.class.php b/inc/form.class.php index f1c5c3021..fbadf5afb 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -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(), @@ -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(),