Bug #92285

TCA type group with multiple enabled selects 2 elements at once

Added by Nikita Hovratov 9 months ago. Updated 3 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2020-09-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you open the element browser and select one item it gets placed two times in the list.
Does not happen on current v11 branch.


Files

tca-group-multiple.gif (5.75 MB) tca-group-multiple.gif Nikita Hovratov, 2020-09-11 09:31
#1

Updated by Daniel Siepmann 3 months ago

Can confirm the issue.
Discovered it via https://github.com/FriendsOfTYPO3/legacy-collections which has the following TCA for a column:

        'items' => [
            'label' => 'LLL:EXT:legacy_collections/Resources/Private/Language/locallang_tca.xlf:sys_collection.items',
            'config' => [
                'type' => 'group',
                'internal_type' => 'db',
                'prepend_tname' => true,
                'allowed' => '*',
                'MM' => 'sys_collection_entries',
                'MM_hasUidField' => true,
                'multiple' => true,
                'size' => 5
            ]
        ],

Not sure what multiple should do, it is not mentioned for fields of type group at docs.typo3.org: https://docs.typo3.org/m/typo3/reference-tca/master/en-us/ColumnsConfig/Type/Group/Properties/Index.html

It either should do nothing, or also be added to docs.

Unsetting the property works (e.g. merge overwrite), setting to false does also work.

Looks like https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js#L130 is called twice. If multiple is true, it will execute twice. If it is false, it will not execute a 2nd time, as it checks for duplicates and stops.
First its called from https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js#L115, and then from https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js#L687.
Both are triggered from https://github.com/TYPO3/TYPO3.CMS/blob/10.4/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ElementBrowser.ts#L168.

Hope that helps to find the bug and bugfix.

Also available in: Atom PDF