FIX / PDF export for assignable asset groups#63
Conversation
|
CHANGELOG please (always update it) |
stonebuzz
left a comment
There was a problem hiding this comment.
Better 🙂
However, we now have a significant amount of duplicated code. We should refactor and consolidate these methods into a single unified implementation.
|
@stonebuzz can I send it to the client ? |
| return implode(', ', array_filter(array_map( | ||
| static fn($group_id) => Toolbox::stripTags(Dropdown::getDropdownName('glpi_groups', $group_id)), | ||
| $group_ids, | ||
| ))); |
There was a problem hiding this comment.
There’s something I’m not fully grasping in this PR.
In GLPI, an object can be assigned to a group using a one-to-one relationship (i.e., the object contains a groups_id or groups_id_tech column, for example in glpi_itilcategories).
Objects can also be assigned to multiple groups through an intermediate relation table, glpi_groups_items (cf: glpi_computers).
These objects rely on that relation table when they use the AssignableItem trait.
Here (unless I’m mistaken), we are only handling the first case.
|
following @stonebuzz comment :
|
Description
groups_idandgroups_id_techwere always scalar values, while GLPI now loads these fields fromglpi_groups_itemsas arrays for assignable items. As a result, group-related fields could be empty or incorrectly rendered in generated PDFs.The classes updated are the ones impacted beacause they correspond to assets implementing the AssignableItem feature.
Screenshots :
Before fix :
After fix :