Skip to content
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

Fix auto assign played after rules in tickets #17088

Conversation

RomainLvr
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets !32840
  • I create a business rule for tickets when they are added that, as soon as a technician group exists in the ticket, the ticket is assigned the status new.
  • I assign a group responsible for the category.
  • I set 'Automatic assignment of tickets, changes and problems' to "category then material" from my entity's support parameters.

When the ticket is created, the group assignments are correct, but the rule assigning a status to the ticket doesn't work.
This is due to the fact that the rule is launched before the automatic assignment in the ticket addition procedure.

@RomainLvr RomainLvr self-assigned this May 7, 2024
@trasher
Copy link
Contributor

trasher commented May 13, 2024

Existing tests are broken.

Also, I'm not sure this kind of issue really can be handled right now; it should cause other issues to change the order of execution :(

@RomainLvr RomainLvr force-pushed the fix/tickets-auto-assign-played-after-rules branch from 4901a70 to 7ddcb44 Compare May 13, 2024 14:40
src/Rule.php Outdated Show resolved Hide resolved
Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a piece of code that is supposed to handle this case:

glpi/src/RuleTicket.php

Lines 206 to 210 in fae0c07

// Special case of status
if ($action->fields["field"] === 'status') {
// Add a flag to remember that status was forced by rule
$output['_do_not_compute_status'] = true;
}

Could you check why it does not work ?

@RomainLvr
Copy link
Contributor Author

There is already a piece of code that is supposed to handle this case:

glpi/src/RuleTicket.php

Lines 206 to 210 in fae0c07

// Special case of status
if ($action->fields["field"] === 'status') {
// Add a flag to remember that status was forced by rule
$output['_do_not_compute_status'] = true;
}

Could you check why it does not work ?

Indeed this case was already treated and it works, the problem still lies in what is mentioned in this ticket: !32835

@RomainLvr
Copy link
Contributor Author

There is already a piece of code that is supposed to handle this case:

glpi/src/RuleTicket.php

Lines 206 to 210 in fae0c07

// Special case of status
if ($action->fields["field"] === 'status') {
// Add a flag to remember that status was forced by rule
$output['_do_not_compute_status'] = true;
}

Could you check why it does not work ?

Indeed this case was already treated and it works, the problem still lies in what is mentioned in this ticket: !32835

Finally, the first concern is that the rule is not executed at all, because one of the criteria required for this rule is not registered until after the rule has been attempted to be executed. As a result, the '_do_not_compute_status' is never set, and the status lock doesn't work.

@cedric-anne
Copy link
Member

Same comment as in #16885. We have to deal with current rules engine limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants