Bug #82221

Copying records with "flex" fields containing FAL IRRE relations fails to move copies to new parent upon workspace publishing

Added by Claus Due about 2 years ago. Updated 3 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2017-08-28
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Prerequisites:

  • Content element with flexform
  • At least one field of type "inline" wanting FAL references
  • A draft workspace

Reproduction, first symptom:

  • Switch to live workspace
  • Create an instance of the content type
  • Fill in at least one FAL relation, best two or more (count of relations is a symptom and having one single relation may confuse)
  • Switch to draft workspace
  • Copy the content element, does not matter where to
  • Observe first symptom: draft record's "pi_flexform" column contains an incorrect FAL reference value (CSV list of UIDs, or single UID, instead of count). Placeholder record contains the correct FAL reference value (number of references). Copies of file relations in sys_file_reference have the correct uid_local value (pointing to the new, copied record).
  • Editing either the original or the copy of the parent record shows the expected relations (note 1)

Reproduction, second symptom:

  • Switch to the workspaces module
  • Perform publishing of all pending changes
  • Observe the second symptom: original record now has double the original file relations and the copy of the parent record has no file relations (uid_local of copies created in sys_file_reference now point to original instead of placeholder)
  • Both backend and frontend now display double relations for original record and no relations for copy of record (note 2).

Notes:

  • Note 1: The expected relations are resolved from the placeholder record which has the correct values, so the GUI shows these relations correctly but the DB data is corrupted.
  • Note 2: The incorrect values get set as part of the "publish workspace" step. The column is NOT in the list of shadow columns (but adding it makes no difference).

Solution:

The solution appears to be adding the UID of the newly created placeholder record as target UID in the substNEWwithIDs array in DataHandler. This one line of code causes both of the symptoms to disappear - the correct relationship UID is then read from the placeholder record and translated to the UID of the copy of the parent record. The code comment immediately outside the condition that checks if a placeholder was created even states that the UID gets recorded, but that currently is not the case. Adding the UID does exactly that.

Issue may exist as far back as TYPO3 7.6 but has been tested on 8.7 and master only. Both exhibit the same symptoms.

testce.zip (4.42 KB) Claus Due, 2017-08-28 01:39

typo3-82221-fal-references-flexform-worspaces.diff View (1.5 KB) Christian Weiske, 2019-06-18 11:49

2019-06-17 typo3 copy-paste workspace.png View (88.4 KB) Christian Weiske, 2019-06-18 11:52


Related issues

Related to Grid Elements (former official tracker) - now moved to Gitlab! - Bug #83778: Files on Flexform imageuploads Accepted 2018-02-05

History

#1 Updated by Gerrit Code Review about 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/53816

#2 Updated by Claus Due about 2 years ago

Attaching extension to easier reproduce this. Instructions:

  • Manually put the extracted extension into TYPO3
  • Create a new content instance
  • Change the CType to "testce"

Note that the new content wizard does not show this content type, it must be selected with the CType selector when editing the content.

The extension adds a new CType with a FlexForm field with a FAL inline relation field that you can use for the above reproduction steps.

#3 Updated by Susanne Moog over 1 year ago

  • Category set to Workspaces

#4 Updated by Jo Hasenau over 1 year ago

  • Related to Bug #83778: Files on Flexform imageuploads added

#5 Updated by Susanne Moog 7 months ago

  • Status changed from Under Review to New

Patch has been abandoned.

#6 Updated by Christian Weiske 3 months ago

As far as I understood the code, the problem is that for non-flexform inline references, DataHandler::remapListedDBRecords() calls remapListedDBRecords_procInline().

For inline references inside flexforms, DataHandler::remapListedDBRecords() calls remapListedDBRecords_flexFormCallBack() which only handles references (type=group||select), but not type=inline. Making the flexFormCallBack handle inline references as well should solve the issue(TM).


Also note that there is an extension that fixes this bug: https://github.com/NamelessCoder/inline_fal_fix

#7 Updated by Christian Weiske 3 months ago

Patch for TYPO3 8.7.26

#8 Updated by Christian Weiske 3 months ago

Screenshot of database data problem in sys_file_reference that occurs without the patch.

#9 Updated by Gerrit Code Review 3 months 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/c/Packages/TYPO3.CMS/+/61085

#10 Updated by Gerrit Code Review 3 months 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/c/Packages/TYPO3.CMS/+/61085

Also available in: Atom PDF