Skip to content

fix(license): duplicate items in software license dropdown - #25029

Open
eduardomozart wants to merge 3 commits into
glpi-project:11.0/bugfixesfrom
eduardomozart:fix-issue-24950
Open

fix(license): duplicate items in software license dropdown#25029
eduardomozart wants to merge 3 commits into
glpi-project:11.0/bugfixesfrom
eduardomozart:fix-issue-24950

Conversation

@eduardomozart

Copy link
Copy Markdown
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • 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

When navigating to the Affected items tab of a License, the dropdown to add new items (such as Computers) was failing to exclude items that were already linked to the license (Closes #24950).

This happened because the dropdown initialization did not pass the used array parameter during the AJAX request, which is required for dropdownAllItems.php to filter out already-linked assets. As a result, items like computers incorrectly reappeared as available to be added.

This PR fixes the issue by querying both glpi_items_softwarelicenses and glpi_softwarelicenses_users to build the used array and correctly passing it along in the $p array to the AJAX dropdown handler.

Screenshots (if appropriate):

image

@eduardomozart eduardomozart changed the title Fix duplicate items in software license dropdown fix(license): duplicate items in software license dropdown Jul 30, 2026
@cconard96

Copy link
Copy Markdown
Member

I see no indication that it is intended for GLPI to support only assigning a single copy of a license to an asset.

@eduardomozart

eduardomozart commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

You're right. I find it a bit odd, but I can see scenarios where it applies, like software that is licensed per user seat, like Microsoft RDP User (licensed per user) and Device (licensed per device) CALs, but GLPI already allows linking licenses for Users and Computer assets if required, so I don't really see a scenario where allowing multiple users and computer license assignments would make sense. Maybe GLPI licensing could support more complex scenarios, like multiple conditions for linking (e.g. allow linking a license to a Computer + User) and not allow duplicates in those cases.
I'll let this PR open so the GLPI team can discuss it, and we can adopt or close this PR altogether; it's fine by me.

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.

Duplicated dropdown entry for linked computer after transfer entities

2 participants