diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5e56e0..cb71fc53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed assignment of requester group to ticket - Ensure plugin works seamlessly in external contexts (e.g., from plugins) - Fixed `Close cloned tickets at the same time` option +- Fixed `Bypass filtering on the groups assignment` option - Rename the option **"Don't change"** to **"Default (not managed by plugin)"** for the **"Ticket status after an escalation"** setting to reduce ambiguity. ## [2.9.10] - 2024-11-27 diff --git a/hook.php b/hook.php index 6913df1a..f4ed6dc0 100644 --- a/hook.php +++ b/hook.php @@ -382,6 +382,13 @@ function plugin_escalade_install() $migration->migrationOneTable('glpi_plugin_escalade_configs'); } + //Update to 2.9.10 + // change fields name + if ($DB->fieldExists('glpi_plugin_escalade_users', 'use_filter_assign_group')) { + $migration->changeField('glpi_plugin_escalade_users', 'use_filter_assign_group', 'bypass_filter_assign_group', 'bool'); + $migration->migrationOneTable('glpi_plugin_escalade_users'); + } + return true; } diff --git a/inc/config.class.php b/inc/config.class.php index 3bdc9eed..b8ebdc35 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -374,7 +374,7 @@ public static function loadInSession() $user = new PluginEscaladeUser(); if ($user->getFromDBByCrit(['users_id' => $_SESSION['glpiID']])) { //if a bypass is defined for user - if ($user->fields['use_filter_assign_group']) { + if ($user->fields['bypass_filter_assign_group']) { $config->fields['use_filter_assign_group'] = 0; } } diff --git a/inc/ticket.class.php b/inc/ticket.class.php index c38f36fb..14781907 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -1116,10 +1116,13 @@ public function showForm($ID, $options = []) $PluginEscaladeGroup_Group = new PluginEscaladeGroup_Group(); $groups_id_filtered = array_keys($PluginEscaladeGroup_Group->getGroups($tickets_id)); $groups_id_filtered = empty($groups_id_filtered) ? [-1] : $groups_id_filtered; + + $user_config = new PluginEscaladeUser(); + $user_config->getFromDBByCrit(['users_id' => Session::getLoginUserID()]); $condition = [ 'is_assign' => 1 ]; - if ($config->fields['use_filter_assign_group']) { + if ($config->fields['use_filter_assign_group'] && !$user_config->fields['bypass_filter_assign_group']) { $condition['id'] = $groups_id_filtered; } TemplateRenderer::getInstance()->display('@escalade/escalade_form.html.twig', [ diff --git a/inc/user.class.php b/inc/user.class.php index 9d73938a..31fa319b 100644 --- a/inc/user.class.php +++ b/inc/user.class.php @@ -38,8 +38,8 @@ class PluginEscaladeUser extends CommonDBTM public static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { - case "use_filter_assign_group": - Dropdown::showYesNo("use_filter_assign_group", 0, -1, [ + case "bypass_filter_assign_group": + Dropdown::showYesNo("bypass_filter_assign_group", 0, -1, [ 'width' => '100%', ]); echo "

getAction()) { - case "use_filter_assign_group": + case "bypass_filter_assign_group": $escalade_user = new self(); $input = $ma->getInput(); foreach ($ids as $id) { if ($escalade_user->getFromDBByCrit(['users_id' => $id])) { - $escalade_user->fields['use_filter_assign_group'] = $input['use_filter_assign_group']; + $escalade_user->fields['bypass_filter_assign_group'] = $input['bypass_filter_assign_group']; if ($escalade_user->update($escalade_user->fields)) { $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK); } else { @@ -126,7 +126,7 @@ public function showForm($ID, array $options = []) $is_exist = $this->getFromDBByCrit(['users_id' => $ID]); if (! $is_exist) { //"Security" - $this->fields["use_filter_assign_group"] = 0; + $this->fields["bypass_filter_assign_group"] = 0; } echo "
"; @@ -138,7 +138,7 @@ public function showForm($ID, array $options = []) echo "