-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to take user's default group on escalade #123
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Cédric Anne <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems OK for me, on the technical point of view.
@stonebuzz Can you do a manual functionnal test and validate this PR ?
Hi @wawax =) It does not seem to work when creating a ticket (GLPI 10)
[_users_id_requester] => Array
(
[_actors_2] => 2
)
Here is a patch if you want to test diff --git a/inc/ticket.class.php b/inc/ticket.class.php
index 8a5e8cc..ed880ca 100644
--- a/inc/ticket.class.php
+++ b/inc/ticket.class.php
@@ -368,45 +368,34 @@ class PluginEscaladeTicket {
}
if (isset($ticket->input['_users_id_assign'])
- && $ticket->input['_users_id_assign'] > 0
- && (!isset($ticket->input['_groups_id_assign'])
- || $ticket->input['_groups_id_assign'] <= 0)) {
+ && $ticket->input['_users_id_assign'] > 0
+ && (!isset($ticket->input['_groups_id_assign'])
+ || $ticket->input['_groups_id_assign'] <= 0
+ || empty($ticket->input['_groups_id_assign']))) {
+
+ $groups_id = 0;
switch ($_SESSION['plugins']['escalade']['config']['use_assign_user_group']) {
case 1 :
// First group
- $ticket->input['_groups_id_assign']
- = PluginEscaladeUser::getTechnicianGroup($ticket->input['entities_id'],
- $ticket->input['_users_id_assign'],
- true);
- //prevent adding empty group
- if (empty($ticket->input['_groups_id_assign'])) {
- unset($ticket->input['_groups_id_assign']);
- }
+ $groups_id = PluginEscaladeUser::getTechnicianGroup($ticket->input['entities_id'],
+ reset($ticket->input['_users_id_assign']), true);
break;
case 2:
// Last groups
- $ticket->input['_additional_groups_assigns']
- = PluginEscaladeUser::getTechnicianGroup($ticket->input['entities_id'],
- $ticket->input['_users_id_assign'],
- false);
- //prevent adding empty group
- if (empty($ticket->input['_additional_groups_assigns'])) {
- unset($ticket->input['_additional_groups_assigns']);
- }
+ $groups_id = PluginEscaladeUser::getTechnicianGroup($ticket->input['entities_id'],
+ reset($ticket->input['_users_id_assign']),false);
break;
-
+
case 3:
//User's default group
- $ticket->input['_additional_groups_assigns']
- = PluginEscaladeUser::getUserDefaultGroup($item->fields['users_id']);
- if (empty($ticket->input['_additional_groups_assigns'])) {
- //prevent adding empty group
- if (empty($ticket->input['_additional_groups_assigns'])) {
- unset($ticket->input['_additional_groups_assigns']);
- }
- }
+ $groups_id = PluginEscaladeUser::getUserDefaultGroup(reset($ticket->input['_users_id_assign']));
break;
}
+
+ //prevent adding empty group
+ if (!empty($groups_id)) {
+ $ticket->input['_groups_id_assign'] = ['_actors_'.$groups_id => $groups_id];
+ }
}
return true;
Best regards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment
This PR add the support for taking user's default group when assigning a ticket to a user