GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing github.com — [Feature] Allow multiple "Insertion in the form" (dom) blocks per entity by JeremieMercier · Pull Request #941 · pluginsGLPI/fields ConversationThis 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 reviewPlease delete options that are not relevant.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
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? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It is also possible to update fields from the fields plugin during ticket update.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Yes, it works Just include the block ID in the field name, like: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hello, do you have time to review the PR ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I applied the changes for PHPStan 🤞 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I don't understand @trasher With php 7.4 : |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A syntax error, it was slipped in after applying the suggestion 😅 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Are we good this time ? 😅🤞 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi, what's the next step ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
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
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hi, @JeremieMercier. Edit: I've done some research and found Postman, as a tool to send HTTP requests and creating API tests |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
051fcd8 to
cf0f71f
Compare
|
Hello, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Hello @CorentinS6, From my side everything seems good, it remains to be seen if a developer of the project can finalize the tests |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
And code generated by AI ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@stonebuzz , is this work good enough for the merge now? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
af76515 to
1aa2594
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
7ee0d82 to
aaf0f14
Compare
|
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? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
9f6178f to
06a3082
Compare
Provide 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.
Closes pluginsGLPI#744, pluginsGLPI#789, pluginsGLPI#834
06a3082 to
f318518
Compare
There was an error while loading. Please reload this page.
|
I 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 ^^ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Several errors in the CI
Sorry, something went wrong.
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
|
hi @Rom1-B, and now ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I’ll put the PR back into draft status, as it is not yet complete (see conflicts) and has not been updated for some time. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Requested changes must be addressed to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.