Uh oh!
There was an error while loading. Please reload this page.
[Feature] Allow multiple "Insertion in the form" (dom) blocks per entity - #941
[Feature] Allow multiple "Insertion in the form" (dom) blocks per entity#941JeremieMercier wants to merge 4 commits into
Conversation
stonebuzz
commented
Apr 9, 2025
I am questioning the plugin's ability to reconcile the correct container during API calls, an issue we have encountered in the past. For example, when updating a ticket and including the "fields" in the payload, could you verify this point? |
Hi @stonebuzz, I retrieve the block row ID like this: Then, I update the field using the following method: So I haven’t encountered any issue with the API — unless I misunderstood how you're updating the fields via the API? |
stonebuzz
commented
Apr 9, 2025
It is also possible to update fields from the fields plugin during ticket update.
|
JeremieMercier
commented
Apr 16, 2025
Hello, do you have time to review the PR ? |
JeremieMercier
commented
Apr 16, 2025
I applied the changes for PHPStan 🤞 |
Uh oh!
There was an error while loading. Please reload this page.
I don't understand @trasher With php 7.4 : |
Uh oh!
There was an error while loading. Please reload this page.
JeremieMercier
commented
Apr 17, 2025
A syntax error, it was slipped in after applying the suggestion 😅 |
JeremieMercier
commented
Apr 17, 2025
Are we good this time ? 😅🤞 |
JeremieMercier
commented
Apr 23, 2025
Hi, what's the next step ? |
The feature you are proposing is substantial and introduces significant changes. To ensure its smooth integration and functionality, we must be extremely vigilant. This means we need to "lock down" our testing to guarantee that everything works as expected. It is important to acknowledge that the plugin is already complex to maintain, especially with the new features introduced in GLPI. Given this complexity, we must approach any additional features with caution to ensure they do not further complicate maintenance and support. To ensure the proper functioning of this PR, here is a concise list of unit tests that should be added: Unit Tests for |
JeremieMercier
commented
May 7, 2025
Hi @stonebuzz Thanks for the message I fully understand the concerns and the importance of thorough testing. While working on the tests already partially in place, I’ve been able to identify and fix some issues especially related to "dropdown" field handling and container restriction management. I’ll keep updating here as I progress. |
Hi, @JeremieMercier. Edit: I've done some research and found Postman, as a tool to send HTTP requests and creating API tests |
JeremieMercier
commented
May 25, 2025
I’ve added all the requested unit tests (except the API ones):
Please note I’m not a testing expert, so the tests may not follow every usual best practice. Feel free to share any feedback so I can improve. The API tests still need to be written by whoever is willing to tackle them. |
051fcd8 to
cf0f71fCompareCorentinS6
commented
Jul 18, 2025
Hello, |
JeremieMercier
commented
Jul 21, 2025
Hello @CorentinS6, From my side everything seems good, it remains to be seen if a developer of the project can finalize the tests |
CorentinS6
commented
Aug 26, 2025
And code generated by AI ? |
JeremieMercier
commented
Aug 28, 2025
Hello, All the logic is 100% mine, however for the tests, it's another story, I used AI to learn and understand the use of the tests in addition to videos like this one from Grafikart, but as I said, I'm not an expert..., the tests can also be redone by a more competent person if necessary knowing that basically, there were no tests set up on the plugin. |
CorentinS6
commented
Aug 28, 2025
@stonebuzz , is this work good enough for the merge now? |
af76515 to
1aa2594CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
7ee0d82 to
aaf0f14CompareJuanPabloToniolo-Udesa
commented
Dec 12, 2025
This will be very useful, now I can only add one block to all entities, I need one per entity and this seems to solve the problem, is there something I can help with? |
killerwanee
commented
Feb 18, 2026
Hi, |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9f6178f to
06a3082CompareProvide the ability to define multiple 'dom' blocks for the same item
based on its entity.
- New PluginFieldsContainer::findContainers() returning all active 'dom'
containers applicable to an item and its entity (with parent entity
handling via getAncestorsOf(), recursivity and profile rights checks).
- Hooks (pre_item_add, pre_item_update, post_item_add) handle multiple
containers through the _plugin_fields_data_multi array.
- populateData() extracts input values from per-container prefixed keys
(plugin_fields_{container_id}_...), with fallback to unprefixed keys.
- fields.html.twig prefixes input names with the container id.
- container.form.php strips the container prefix before calling
updateFieldsValues(), enabling domtab containers saving.
- showForTab() renders every applicable container, each with its own
scoped refresh script.
- Add PHPUnit coverage: findContainers (subtypes, entity recursion),
multi-container hooks, populateData prefix and multi-selection
handling, showForTab display and rights.
ClosespluginsGLPI#744, pluginsGLPI#789, pluginsGLPI#83406a3082 to
f318518CompareI originally opened this PR because it was an internal feature request for how we use the GLPI plugin. In the end, we managed without it, so I kind of let it drop especially with the commit lag and conflicts to deal with. Anyway, I've decided to pick it back up: even though we don't need the feature ourselves anymore, it could still be useful to others since it's quite heavily requested ^^ |
Uh oh!
There was an error while loading. Please reload this page.
- populateData(): accept bare field names (API/external callers) as fallback of the new prefixed input names - populateData(): treat null input values as not provided (isset semantics), fixes SQL error on empty dropdown submitted from a form destination - preItem(): restore explicit c_id support (tab forms, form destinations) - findContainers(): JSON-encode itemtype for JSON_CONTAINS to support namespaced itemtypes on strict MySQL - richtext companion inputs stored under the column-based key expected by addRichTextFiles() - tests: multiple dom containers per itemtype are now expected to be allowed - tests: do not leak $_REQUEST['massiveaction'] between test files
…m-blocks # Conflicts: # CHANGELOG.md






This PR provides the ability to define multiple "Insertion in the form" blocks for the same item based on its entity
Please test these modifications and verify that everything works as expected for all object types supported by the Fields plugin. Note that my tests were successful, although I focused exclusively on 'Ticket' type objects for my use case.
Checklist before requesting a review
Please delete options that are not relevant.
Issues : #744, #789, #834