fix(license): duplicate items in software license dropdown - #25029
fix(license): duplicate items in software license dropdown#25029eduardomozart wants to merge 3 commits into
Conversation
fc8c748 to
75687c3
Compare
|
I see no indication that it is intended for GLPI to support only assigning a single copy of a license to an asset. |
|
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. |
Checklist before requesting a review
Please delete options that are not relevant.
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
usedarray parameter during the AJAX request, which is required fordropdownAllItems.phpto 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_softwarelicensesandglpi_softwarelicenses_usersto build theusedarray and correctly passing it along in the$parray to the AJAX dropdown handler.Screenshots (if appropriate):