Repository navigation
Conversation
Add support for GLPI 11 Custom Assets in TreeView. - Discover Custom Asset classes through AssetDefinitionManager - Filter the shared assets table by asset definition - Use Custom Asset search and form URLs Related to pluginsGLPI#108
Rom1-B
left a comment
There was a problem hiding this comment.
Can you add a functional test covering the assets_assetdefinitions_id filter? E.g. two active AssetDefinitions with an item each under the same location, asserting getNodesFromDb() only shows the item matching the requested type (regression guard against cross-definition leakage on the shared glpi_assets_assets table).
Please also fix lint and update CHANGELOG.
|
@BenLasTed please fix CI |
| if (class_exists(AssetDefinitionManager::class)) { | ||
| $types = array_merge( | ||
| $types, | ||
| AssetDefinitionManager::getInstance()->getCustomObjectClassNames() | ||
| ); | ||
| } |
There was a problem hiding this comment.
Since the plugin requires GLPI >= 11.0.0 (PLUGIN_TREEVIEW_MIN_GLPI), AssetDefinitionManager always exists here; this class_exists() guard is dead code.
| if (class_exists(AssetDefinitionManager::class)) { | |
| $types = array_merge( | |
| $types, | |
| AssetDefinitionManager::getInstance()->getCustomObjectClassNames() | |
| ); | |
| } | |
| $types = array_merge( | |
| $types, | |
| AssetDefinitionManager::getInstance()->getCustomObjectClassNames() | |
| ); |
|
I'm putting the PR back in draft status so I won't be contacted while you're fixing the CI issues and reviews. |
|
CI now passes on my fork after fixing the test permissions, Composer configuration, formatting and licence headers. The conflict with main is resolved. Ready for review: https://github.com/BenLasTed/treeview/actions/runs/37907430048 |
Description
GLPI 11 moves GenericObject-based assets to the core Custom Assets system. TreeView currently only discovers its static list of item types, so migrated Custom Assets are not displayed.
This PR adds GLPI 11 Custom Asset support by:
AssetDefinitionManager;glpi_assets_assets;getSearchURL()andgetFormURL()methods for navigation.Testing
Tested with:
Verified:
Related to #108