Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion inc/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down
12 changes: 6 additions & 6 deletions inc/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<br><br><input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" .
Expand All @@ -57,13 +57,13 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
public static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
{
switch ($ma->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 {
Expand Down Expand Up @@ -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 "<form action='" . $this->getFormURL() . "' method='post'>";
Expand All @@ -138,7 +138,7 @@ public function showForm($ID, array $options = [])
echo "<td><label>";
echo __("Bypass filtering on the groups assignment", "escalade");
echo "&nbsp;";
Dropdown::showYesNo("use_filter_assign_group", $this->fields["use_filter_assign_group"], -1, [
Dropdown::showYesNo("bypass_filter_assign_group", $this->fields["bypass_filter_assign_group"], -1, [
'width' => '100%',
'rand' => $rand,
]);
Expand Down