Bug #76863

Story #69617: FormEngine bugs

MM Relation with selectMultipleSideBySide Field - Add wizard resets the MM Relation

Added by Volker Kemeter over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
FormEngine aka TCEforms
Start date:
2016-06-29
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Stabilization Sprint

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.

  1. add test1 entry
  2. add relation in that test1 entry via add icon
  3. repeat
  4. add relation items in listview
  5. edit test1 entry
  6. add all the relation items and save
  7. use add button to create a new relation
  8. relations are resetted

test_0.0.0_201606290853.zip - test extension (514 KB) Volker Kemeter, 2016-06-29 11:03

screenshot-typo3review.dev 2017-04-21 10-25-50.png View (253 KB) Kevin Ditscheid, 2017-04-21 10:28


Related issues

Related to TYPO3 Core - Bug #79712: triple entries in mm table when copying page New 2017-02-09
Related to TYPO3 Core - Bug #81855: Add new record wizard fails on Save&Close with "select" field and MM setted Closed 2017-07-13
Related to TYPO3 Core - Bug #82016: Wizards add still not working with MM Closed 2017-08-01
Related to TYPO3 Core - Bug #82461: Backend/TCA: fieldControl->addRecord removes old relations after creating an new entry in the foreign table for the new relation Closed 2017-09-12
Duplicated by TYPO3 Core - Bug #81824: Wizards add not working with MM Closed 2017-07-10

Associated revisions

Revision 3053e33f (diff)
Added by Thomas Hohn over 2 years ago

[BUGFIX] MM Relation with add wizard resets the MM Relation

Use the TcaDatabaseRecord instead of OnTheFly instance. This
in done to ensure what we have the same data as in
TYPO3\CMS\Backend\Controller\EditDocumentController makeEditForm
method.

Resolves: #76863
Relates: #80172
Releases: master, 8.7, 7.6
Change-Id: Ie733491e65169101fda52465e9b980b3db9e20c2
Reviewed-on: https://review.typo3.org/51976
Tested-by: TYPO3com <>
Reviewed-by: Thomas Hohn <>
Tested-by: Thomas Hohn <>
Reviewed-by: Kevin Ditscheid <>
Tested-by: Kevin Ditscheid <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 9675455b (diff)
Added by Thomas Hohn about 2 years ago

[BUGFIX] MM Relation with add wizard resets the MM Relation

Use the TcaDatabaseRecord instead of OnTheFly instance. This
in done to ensure what we have the same data as in
TYPO3\CMS\Backend\Controller\EditDocumentController makeEditForm
method.

Resolves: #76863
Relates: #80172
Releases: master, 8.7, 7.6
Change-Id: Ie733491e65169101fda52465e9b980b3db9e20c2
Reviewed-on: https://review.typo3.org/53414
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 9f853168 (diff)
Added by Thomas Hohn about 2 years ago

[BUGFIX] MM Relation with add wizard resets the MM Relation

Use the TcaDatabaseRecord instead of OnTheFly instance. This
in done to ensure what we have the same data as in
TYPO3\CMS\Backend\Controller\EditDocumentController makeEditForm
method.

Resolves: #76863
Relates: #80172
Releases: master, 8.7, 7.6
Change-Id: Ie733491e65169101fda52465e9b980b3db9e20c2
Reviewed-on: https://review.typo3.org/53415
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Wouter Wolters over 3 years ago

  • Assignee deleted (Mathias Schreiber)
  • Priority changed from -- undefined -- to Could have

#2 Updated by Christian Kuhn about 3 years ago

  • Parent task set to #69617

#3 Updated by Volker Kemeter about 3 years ago

also reproduced with version 8.4.0-dev

#4 Updated by Markus Kobligk about 3 years ago

Confirmed on 7.6.9

#5 Updated by Kevin Ditscheid about 3 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.

#6 Updated by Gernot Ploiner almost 3 years ago

Hi Kevin, thank you for your "Hotfix-Extension". It works fine in our case with TYPO3 7.6.14.

#7 Updated by Michael Christian almost 3 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.

#8 Updated by Josef Glatz over 2 years ago

  • TYPO3 Version changed from 7 to 8

#9 Updated by Josef Glatz over 2 years ago

  • Target version set to 8 LTS

#10 Updated by Thomas Hohn over 2 years ago

  • Assignee set to Thomas Hohn
  • PHP Version set to 7.0
  • Sprint Focus set to Stabilization Sprint

#11 Updated by Gerrit Code Review over 2 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

#12 Updated by Gerrit Code Review over 2 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

#13 Updated by Gerrit Code Review over 2 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

#14 Updated by Gerrit Code Review over 2 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

#15 Updated by Gerrit Code Review over 2 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

#16 Updated by Benni Mack over 2 years ago

  • Target version changed from 8 LTS to Candidate for patchlevel

#17 Updated by Gerrit Code Review over 2 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

#18 Updated by Kevin Ditscheid over 2 years ago

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!

#19 Updated by Gerrit Code Review over 2 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

#20 Updated by Kevin Ditscheid over 2 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?

#21 Updated by Thomas Hohn over 2 years ago

Could you please add the TCA configuration that works for you and then I'll have a look at it

#22 Updated by Kevin Ditscheid over 2 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.

#23 Updated by Kevin Ditscheid over 2 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.

#24 Updated by Gerrit Code Review over 2 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

#25 Updated by Gerrit Code Review over 2 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

#26 Updated by Gerrit Code Review over 2 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

#27 Updated by Gerrit Code Review over 2 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

#28 Updated by Thomas Hohn over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 30 to 100

#29 Updated by Kevin Ditscheid over 2 years ago

  • Duplicated by Bug #81824: Wizards add not working with MM added

#30 Updated by Georg Ringer over 2 years ago

  • Related to Bug #81855: Add new record wizard fails on Save&Close with "select" field and MM setted added

#31 Updated by XIMA MEDIA GmbH about 2 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 .

#32 Updated by XIMA MEDIA GmbH about 2 years ago

  • Related to Bug #82016: Wizards add still not working with MM added

#33 Updated by Mathias Brodala over 1 year 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

#34 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF