Skip to content

Fix ITIL Item Tabs #19421

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

cconard96
Copy link
Contributor

@cconard96 cconard96 commented Apr 9, 2025

Checklist before requesting a review

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

Several issues were seen with various ITIL Item tabs including wrong tab counts, "Show All" button link mixing SQL criteria and search engine criteria, and some redundant/messy code. This aims to resolve #18985 and #19378. This PR may will turn into a rewrite due to the scope of the issues.

@cconard96 cconard96 force-pushed the fix/itil_item_tabs branch 3 times, most recently from 04fd4d8 to 6c0a4f9 Compare May 5, 2025 17:33
@cconard96 cconard96 force-pushed the fix/itil_item_tabs branch from 6c0a4f9 to d8bee71 Compare May 8, 2025 18:29
@cconard96
Copy link
Contributor Author

Need an initial review to make sure I haven't missed any expected functionality. Given the large number of deletions vs additions, not including the new tests, it is possible something was accidentally removed rather than there just being a ton of duplicated code.

I also can never seem to figure out how tab counters are supposed to be handled when it comes to some items not being visible within the current entity or not visible because of item-specific permissions. Should tab counters always show the actual count, or visible count? Seems like the actual count would be the right option along with a note in the tab that some items are not currently visible, but that isn't how it is displayed in most places.

The use of CommonItilObject_Item to link items with TicketRecurrent which isn't an ITIL Object complicates things but since it was like this in 10.0, I have left it like this rather than change it within the GLPI 11 beta phase.

I am aware that some E2E tests are needed still.

@cconard96 cconard96 marked this pull request as ready for review May 11, 2025 17:18
@cedric-anne
Copy link
Member

Need an initial review to make sure I haven't missed any expected functionality. Given the large number of deletions vs additions, not including the new tests, it is possible something was accidentally removed rather than there just being a ton of duplicated code.

Honestly, it is hard to detect it, due to the amount of code changes. The most critical parts are probably tested (rules, for instance).

Seems like the actual count would be the right option along with a note in the tab that some items are not currently visible, but that isn't how it is displayed in most places.

I agree that we should always display the actual count and with a note that indicates how many items are not shown due to visibility restrictions, but this is not how things are done right now. Maybe we should write a RFC about this in order to validate what should be the target. For the moment, I guess counters should just show how many items are visible.

@cedric-anne cedric-anne requested a review from orthagh May 12, 2025 08:46
@cconard96
Copy link
Contributor Author

cconard96 commented May 12, 2025

The use of CommonItilObject_Item to link items with TicketRecurrent which isn't an ITIL Object complicates things but since it was like this in 10.0, I have left it like this rather than change it within the GLPI 11 beta phase.

Actually it looks like this just missed the 10.0 release. So, I guess it could be refactored now.

Honestly, it is hard to detect it, due to the amount of code changes. The most critical parts are probably tested (rules, for instance).

At least the "Add ability to define linked items on TicketRecurrent" feature had no tests added for it. I don't think tests existed for how ITIL items on assets were supposed to be counted/displayed either. It seems like assets are supposed to count tickets on connected peripherals as their own tickets.

Also, it isn't an immediate concern but I am interested in people's thoughts about the TODO comment I added:

        //TODO Costs for changes and problems should probably affect TCO too but there should also be a way to handle costs affecting multiple assets
        //Example, A ticket with a cost of $400 with two computers shouldn't add $400 cost of ownership to both.

@cedric-anne
Copy link
Member

Actually it looks like this just missed the 10.0 release. So, I guess it could be refactored now.

If it simplifies something, you can refactor it, but keep in mind that we have to publish the RC release in the next few weeks and we will probably not accept a huge refactoring after that.

@cconard96 cconard96 force-pushed the fix/itil_item_tabs branch from de50efe to bf6899a Compare May 24, 2025 11:27
@cconard96
Copy link
Contributor Author

Actually it looks like this just missed the 10.0 release. So, I guess it could be refactored now.

If it simplifies something, you can refactor it, but keep in mind that we have to publish the RC release in the next few weeks and we will probably not accept a huge refactoring after that.

I don't think I'll have time for additional refactoring with this.

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

Successfully merging this pull request may close these issues.

"Show all" on tickets tab is broken
3 participants