You are not logged in.
I create a Rule for Tickets which is triggering on specific tickets. If it is triggered it adds multiple (15) task template.
I've added the tasks in order in the rule in the correct order and named them:
something > 1 more text
something > 2 more text
something > 3 more text
something > 4 more text
..
I've also made sure that they are created one after another to make sure the ID's in the table are in order.
However, when the rule is triggered the tasks are not added in the expected order.
So it seems that it's not sorting them by the "name of the template", "order they are added to the rule" nor the "ID's in the database".
How can I add them in the specified order? What am I doing wrong?
Offline
Please test with the latest bug-fix release (10.0.10). A similar issue was fixed recently an should be a part of the latest release.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Thank you for the fast reply!
I will try to prepare an update, which requires a lot of testing. Will let you know if it is not working.
Thanks!
Offline
Updated but the problem persists
Offline
Definitely a bug!
I've tested it on another system (with only 3 elements) and it worked. So I created a new rule and added some ... it worked ... until I added more.
Category Assign XX > XXX
Technician group Assign VXXX
Task template Add XXX - XXX
Task template Add XXX > 1 XXX
Task template Add XXX > 2 XXX
Task template Add XXX > 3 XXX
Task template Add XXX > 4 XXX
Task template Add XXX > 5 XXX
Task template Add XXX > 6 XXX
Task template Add XXX > 7 XXX
Task template Add XXX > 8 XXX
Task template Add XXX > 9 XXX
Task template Add XXX > 10 XXX
Testet 3 times -> worked perfectly.
After adding ONE more task template it completely messed up the order of all elements (tested 3 times)!
Last edited by Rafumel1774 (2023-09-27 17:54:32)
Offline
Can someone confirm this?
Offline
There is a bug report for this, but it hasn't been confirmed/troubleshot yet.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Digging deep into this issue, it seems to be working to fine in the "logic" from the processing of the "rules module".
However, it is an issue with the "representation" layer.
The data is properly added to the "glpi_tickettasks" table in the correct order with the IDs and so on.
But it seems that the "representation layer" is sorting by the timestamp for "date_creation of the element and as there seems to be many elements with exactly the time timestamp (seconds - not miliseconds) there seems to be a mixup.
Offline
Found it!
Caused by CommonITILObject.php
Around line 7267
//sort timeline items by date
$reverse = $params['sort_by_date_desc'];
usort($timeline, function ($a, $b) use ($reverse) {
$date_a = $a['item']['date_creation'] ?? $a['item']['date'];
$date_b = $b['item']['date_creation'] ?? $b['item']['date'];
$diff = strtotime($date_a) - strtotime($date_b);
return $reverse ? 0 - $diff : $diff;
});
This messes the order up as the date_creation is the same for all tasks as the rule module processed them in the same seconds.
@cconard96: Maybe you can make the function from the rule processing less efficent and slower
Offline
This messes the order up as the date_creation is the same for all tasks as the rule module processed them in the same seconds.
@cconard96: Maybe you can make the function from the rule processing less efficent and slower
Or, we could just sort by creation date and then ID
I made a pull request for a potential fix:
https://github.com/glpi-project/glpi/pull/15856
You can see the changes made on the "Files changed" tab. Only the changes made to "src/CommonITILObject.php" apply. The rest is just for code tests.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Guess thats why you are the developers
Yes, I can confirm that it is working fine and fixed the order for all open tickets in my system without affecting other tasks.
Thank you!
Offline