Project

General

Profile

Actions

Bug #90925

closed

Incorrectly selected items in MM select fields

Added by Sebastian Lechenbauer about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
Start date:
2020-04-01
Due date:
% Done:

100%

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

Description

After updating from TYPO3 9.5.14 to 9.5.15 there are incorrectly selected items in some of my backend select fields with MM relations.

I can reproduce this behaviour in 9.5.14 with a patch of change "2020-03-06 622e1a3dcd [BUGFIX] Reorder processing of TCA select items again".

The function call in TcaSelectItems.php line 87:

$result['databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $staticValues);

changed there to:
$result['databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $itemArray);

$staticValues is empty, but $itemArray is filled in my case with all available items - and compared in AbstractDataProvider to the $currentDatabaseValueArray which holds the number of relations for MM select fields.

    protected function processSelectFieldValue(array $result, $fieldName, array $staticValues)
    {
        $fieldConfig = $result['processedTca']['columns'][$fieldName];

        $currentDatabaseValueArray = array_key_exists($fieldName, $result['databaseRow']) ? $result['databaseRow'][$fieldName] : [];
        $newDatabaseValueArray = [];

        // Add all values that were defined by static methods and do not come from the relation
        // e.g. TCA, TSconfig, itemProcFunc etc.
        foreach ($currentDatabaseValueArray as $value) {
            if (isset($staticValues[$value])) {
                $newDatabaseValueArray[] = $value;
            }
        }

As a result the MM select field gets as additional item the record with uid == number of relations, which can not be deleted.


Related issues 4 (1 open3 closed)

Related to TYPO3 Core - Bug #85142: Recent reordering of TCA select items processing makes it impossible to post-process foreign_table itemsClosed2018-06-02

Actions
Related to TYPO3 Core - Bug #89998: Problem in TCA with type select if MM relation is usedAcceptedGeorg Ringer2019-12-20

Actions
Related to TYPO3 Core - Bug #90999: selectMultipleSideBySide adds non selected itemsClosed2020-04-11

Actions
Has duplicate TYPO3 Core - Bug #91062: MM select displays not saved items in 9.5.15Closed2020-04-16

Actions
Actions

Also available in: Atom PDF