Bug #76863
closedStory #69617: FormEngine bugs
MM Relation with selectMultipleSideBySide Field - Add wizard resets the MM Relation
Added by Volker Kemeter over 8 years ago. Updated about 6 years ago.
100%
Description
when you create an extension with one table and a mm relation to another table (no special features needed) and the tca for the relation is set to "selectMultipleSideBySide" you can add the created items from right to left.
but when you use the add wizard to create a new item, the saved relations are resetted to "two" items where the first one is exactly the count of the "old" relation (for example 4 relations where set) and the new item prepended.
i added an example extension (build with extension builder) to demonstrate that behavior.
- add test1 entry
- add relation in that test1 entry via add icon
- repeat
- add relation items in listview
- edit test1 entry
- add all the relation items and save
- use add button to create a new relation
- relations are resetted
Files
test_0.0.0_201606290853.zip (514 KB) test_0.0.0_201606290853.zip | test extension | Volker Kemeter, 2016-06-29 11:03 | |
screenshot-typo3review.dev 2017-04-21 10-25-50.png (253 KB) screenshot-typo3review.dev 2017-04-21 10-25-50.png | Kevin Ditscheid, 2017-04-21 10:28 |
Updated by Wouter Wolters over 8 years ago
- Assignee deleted (
Mathias Schreiber) - Priority changed from -- undefined -- to Could have
Updated by Volker Kemeter about 8 years ago
also reproduced with version 8.4.0-dev
Updated by Kevin Ditscheid about 8 years ago
Could someone test my solution for this? I created a GIT repository with an extension, that changes the FormDataCompiler to provide the MM relations instead of just fetching the record from the database and prepend/append the new record uid to the value of the database row.
https://github.com/bara0801/add_wizard
The magic happens in the AddController, which is just an override for the TYPO3\CMS\Backend\Controller\Wizard\AddController classes main method. There I replaced the OnTheFly instance with the TcaDatabaseRecord instance, to have the same data compiling as in the TYPO3\CMS\Backend\Controller\EditDocumentController->makeEditForm method.
As my approach is just a little hotfix for a project of mine, this is not tested on breaking other functionalities, yet, but I hope it could help someone integrating a fix into the core.
Updated by Gernot Ploiner almost 8 years ago
Hi Kevin, thank you for your "Hotfix-Extension". It works fine in our case with TYPO3 7.6.14.
Updated by Michael Christian almost 8 years ago
- Priority changed from Could have to Must have
- % Done changed from 0 to 30
Hi, the "add_wizard bugfix extension" is working fine in my case, too. I tested it with a MM Relation to tx_news and with V7.6.9.
Thanks a lot to Kevin Ditscheid for the Bugfix and Volker Kemeter for the Bugreport and Test-Extension!
Could someone please fix the Core.
Updated by Thomas Hohn over 7 years ago
- Assignee set to Thomas Hohn
- PHP Version set to 7.0
- Sprint Focus set to Stabilization Sprint
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Benni Mack over 7 years ago
- Target version changed from 8 LTS to Candidate for patchlevel
Updated by Gerrit Code Review over 7 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Kevin Ditscheid over 7 years ago
- File screenshot-typo3review.dev 2017-04-21 10-25-50.png screenshot-typo3review.dev 2017-04-21 10-25-50.png added
I still get an error when trying to add a new record via the add-wizard button.
I've tried to test the patches from the review system by fetching the commit via git, composer install and setup the fresh system via install procedure in the browser and installing the test extension provided via extension manager.
I also did download the current 8.7.2-dev and applied the patchfile manually with no success.
I captured a screenshot of the error and the stacktrace !screenshot-typo3review.dev 2017-04-21 10-25-50.png!
Updated by Gerrit Code Review over 7 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Kevin Ditscheid over 7 years ago
I've to update this again with some questions of mine.
It seems that this issue has resolved itself nowadays, because in all 3 of the current TYPO3 branches, master, 8.7 and 7.6, the behaviour has changed when clicking the "Add new" Button of the wizard.
Instead of silently trashing the selection, the FormEngine now warns you with an alert like when leaving the record by closing it with unsaved changes. This not only resets the selection of items since the last item has been added, but since the record has been saved last. So, the wizard isn't treated as a kinda "popup" anymore, but as a "leaving the record" request. For me this would render this issue and the patches irrelevant and requires a new discussion about rather the current behaviour of leaving the record entirely is a good or a bad one.
Just for the record: The way of introducing add-buttons has changed in v8.7, too, because there are field controls now. I am unable to say whether or not this new type of configuration uses the same wizard logic, but it is causing the same behaviour as I described above.
So how to handle this issue now?
Updated by Thomas Hohn over 7 years ago
Could you please add the TCA configuration that works for you and then I'll have a look at it
Updated by Kevin Ditscheid over 7 years ago
Thomas Hohn wrote:
Could you please add the TCA configuration that works for you and then I'll have a look at it
The test extension does exactly what I described in 7.6 on latest master. And from there on out, all methods of including an add wizard do.
You could also test it via the styleguide extension.
Updated by Kevin Ditscheid over 7 years ago
Sry for the late update on this:
After testing this issue again with a little time to look over it freshly, I discovered that I only tested with new records, not with existing ones.
For existing ones, the patch works totally fine.
However, for new records, the behaviour still is a different one in my tests.
Updated by Gerrit Code Review over 7 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/51976
Updated by Gerrit Code Review over 7 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53414
Updated by Gerrit Code Review over 7 years ago
Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53415
Updated by Thomas Hohn over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 30 to 100
Applied in changeset 3053e33f2d85b7fe920caa074acfd91d67cf721d.
Updated by Kevin Ditscheid over 7 years ago
- Has duplicate Bug #81824: Wizards add not working with MM added
Updated by Georg Ringer over 7 years ago
- Related to Bug #81855: Add new record wizard fails on Save&Close with "select" field and MM setted added
Updated by XIMA MEDIA GmbH over 7 years ago
It seems the new version 7.6.21 does not fix this bug as mentioned in the changelog (https://wiki.typo3.org/TYPO3_CMS_7.6.21).
My TCA for the add-wizard is configured as in step 2 described here: https://forge.typo3.org/issues/81824 .
Updated by XIMA MEDIA GmbH over 7 years ago
- Related to Bug #82016: Wizards add still not working with MM added
Updated by Mathias Brodala almost 7 years ago
- Related to Bug #82461: Backend/TCA: fieldControl->addRecord removes old relations after creating an new entry in the foreign table for the new relation added