Closed andrepetinga closed 4 years ago
I think I just found the answer in the GLPI forum:
In fact the root cause for this is the fact that a ticket must be assigned into an entity, and to get this entity, I use the entity of the 'post-only' profile.
So, all our users have the "Self-Service" Profile, and all of them are mapped to the parent entity (with "Recursive" option), because in the future, we will have multiple entities, and all users must belong to all entities, so all of them can create tickets regardless of the entity. And reading your answer, when we use the ##from tag, the ticket will be placed on our root entity, because that is the "main entity" of all our users.
What can we do to place the ticket in the correct entity? Since our rule seems to be ignored when using the ##from tag...
For now I (partially) solved the problem, by changing this:
$parm->input['entities_id'] = current( $entity );
Into this:
$parm->input['entities_id'] = 1 ;
Because the entity I want (for now) is the number 1.
The problem will be when we add more entities...
Can we have access to all of the mail properties? Like the "TO" and ""CC" addresses? If so, We can make a change in the code: depending on the "TO" and/or "CC" address, we can force the entity ID.
I think I got it. If we change that line to:
$parm->input['entities_id'] = $parm->input['_mailgate'];
It gets the ID of the mailgate. We just have to make sure that the Entity ID is the same as the Receiver ID.
Hello @andrepetinga I think that the forum is not up to date with the current behavior of the plugin. I'll check that and keep you informed. Could you indicate the versions of GLPI, plugins you are using? Thank you Regards, Tomolimo
Hello. GLPI 9.4.5 Plugins: Escalade 2.4.2 File Injection 2.7.0 FusionInventory 9.4+1.1 mailanalyzer 1.6.0 More Reporting 1.6.1 PHP SAML 1.0.0
Regards
Hello @andrepetinga Did you test with the latest version, the 1.6.1? Thank you Regards, Tomolimo
Hello. Just tested the 1.6.1 and it still doesn't work like we want. All tickets are placed in the Root Team and not in the team regarding the email we send the ticket to.
So like I said before, to solve our problem, I've changed this:
$parm->input['entities_id'] = current( $entity );
into this:
$parm->input['entities_id'] = $parm->input['_mailgate'];
And we just have to make sure that the Entity ID is the same as the Receiver ID.
Hello @andrepetinga
To explain: the ##From has been developed so that the ticket will be created into the entity of the requester (the user found after the ##From). but a GLPI user has no entity on its own, so I used the so called 'post-only' profile (or self-service profile) to map the entity of the authorization of this profile for the requester (found after the ##From) to the entity of the ticket.
However to solve your issue, you just need to create a rule in the "rules for assigning a ticket created through a mails receiver", and from here, you may define a rule per receiver to set the entities of the tickets.
Thank you, Regards, Tomolimo
Hello again @andrepetinga To give details:
And then create a new rule like:
and action like this:
You must create as many rules as you have receivers. And like that you'll not have the trouble of the id of the receivers like you said in your post.
Thank you Regards, Tomolimo
hello. Yes, I understand your explanation (I read that info in a forum). And yes, I have a rule for each entity, just like you said. But still, every email received with the tag ##from, it ALWAYS stays in the root entity!
All my GLPI users have their self-service profile linked to this root entity with Recursive option active, so that they can be mapped with all child entities.
So I don't know why this is not working :)
Regards, André Petinga
Hello @andrepetinga
I believe the explanation is because the rules are executed before the hook of the plugin, then the plugin will modify the ticket entity after the rules have been executed.
I suggest you to simply comment out the line that assign the entity in the plugin.
like: // $parm->input['entities_id'] = current( $entity );
Thank you, Regards, Tomolimo
Hello. Yes, if I comment out that line, it works :) So the problem is just because of the rules are executed before the hook. No problem for me, since I have a rule for each entity, so I can leave the line with the comment and works well.
Thanks! Regards, André Petinga
Hello @andrepetinga Thank you for the feedback, Regards, Tomolimo
Hello. I’ve installed the mailanalyzer plugin for GLPI and now I have an issue:
I have the following rule:
Rules for assigning a ticket created through a mails receiver
Criteria -> Mails Receiver is “entity email address”
And all the emails are placed in this Entity. When we use the tag ##from:email_address, the ticket is created on the parent entity ! Not the one that is configured in the rule.
Why? Is there a logical explication that I’m missing?