glpi icon indicating copy to clipboard operation
glpi copied to clipboard

Fix (ProjectTask) - Allow linking tickets to closed project tasks

Open RomainLvr opened this issue 3 months ago • 11 comments

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):

image image

RomainLvr avatar Nov 21 '25 11:11 RomainLvr

E2E failure can be ignored.

AdrienClairembault avatar Nov 26 '25 08:11 AdrienClairembault

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

orthagh avatar Nov 26 '25 09:11 orthagh

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?

cedric-anne avatar Nov 26 '25 09:11 cedric-anne

Is this OK for you?

No, Like I said, It will bother more people.

orthagh avatar Nov 26 '25 09:11 orthagh

(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.)

AdrienClairembault avatar Nov 26 '25 10:11 AdrienClairembault

@orthagh @cedric-anne @AdrienClairembault What should we do in this case? We need to agree on a solution.

RomainLvr avatar Nov 26 '25 12:11 RomainLvr

@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

orthagh avatar Nov 26 '25 13:11 orthagh

I think the E2E failures are the same and can therefore be ignored

RomainLvr avatar Nov 28 '25 14:11 RomainLvr

ping @orthagh

RomainLvr avatar Dec 01 '25 08:12 RomainLvr

I will send the patch to the client for approval.

RomainLvr avatar Dec 04 '25 10:12 RomainLvr

I put the PR to draft until we get the client approval.

cedric-anne avatar Dec 09 '25 13:12 cedric-anne