Fix (ProjectTask) - Allow linking tickets to closed project tasks
Checklist before requesting a review
Please delete options that are not relevant.
- [x] I have read the CONTRIBUTING document.
- [x] I have performed a self-review of my code.
- [x] I have added tests that prove my fix is effective or that my feature works.
- [ ] This change requires a documentation update.
Description
- It fixes !40409
- Here is a brief description of what this PR does
This PR improves the project task linking interface for tickets and ensures consistent behavior by filtering closed/finished projects and tasks.
Issues Fixed
- Project dropdown now shows only open projects (closed/finished projects are filtered out)
- Project task dropdown now shows only open tasks (tasks with finished states are filtered out)
- Task dropdown only appears after selecting a project (better UX with cascading dropdowns)
- Tasks are properly filtered by the selected project
- Already linked tasks are excluded from the dropdown to prevent duplicates
- Fixed hardcoded project state IDs (now dynamically queries finished states)
Screenshots (if appropriate):
E2E failure can be ignored.
This filtering was added in https://github.com/glpi-project/glpi/pull/4598
This is typically the case where we can't satisfy everybody, and I'm strongly against adding an option for this. Honestly, I think we'll bother fewer people by filtering the closed cases.
Regarding the original ticket, not wanted by the requester, but if we want to harmonize, we also shouldn't allow linking closed projects in ticket UI
This filtering was added in #4598
This is typically the case where we can't satisfy everybody, and I'm strongly against adding an option for this. Honestly, I think we'll bother fewer people by filtering the closed cases.
Regarding the original ticket, not wanted by the requester, but if we want to harmonize, we also shouldn't allow linking closed projects in ticket UI
The current PR removes the filtering on closed tickets. It means that, if we validate it, closed projects will be shown in project/tickets link dropdowns. Is this OK for you?
Is this OK for you?
No, Like I said, It will bother more people.
(If you don't merge this, the $condition = ['glpi_projecttasks.projectstates_id' => ['<>', 3]]; line should still be modified as projects states IDs are not hardcoded.)
@orthagh @cedric-anne @AdrienClairembault What should we do in this case? We need to agree on a solution.
@RomainLvr
wanted behavior and points listed at top:
- open tickets can be linked in closed project -> OK in this pr but check only open are displayed
- Projects dropdown should list only open and not close ones -> not OK
- Task dropdown only appears after selecting a project -> OK
- Tasks are properly filtered by the selected project -> OK
- Already linked tasks are excluded from the dropdown -> OK
More generaly, if you want to extends this behavior regarding the original ticket -> Dropdowns should only list items that are not closed/archived.
Making the inverse behavior will pollute a lot of people process.
And finally, contact the customer, I know him and if we want precision I'm available
I think the E2E failures are the same and can therefore be ignored
ping @orthagh
I will send the patch to the client for approval.
I put the PR to draft until we get the client approval.