Project

General

Profile

Actions

Bug #92804

closed

Sorting of inline records that contain inline records breaks the database

Added by Johannes Schlier about 4 years ago. Updated over 3 years ago.

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

100%

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

Description

Sorting inline records (let's call them 'parent records') that contain more inline records (let's call these 'children records') in FormEngine results in a mix of uids of parent and children records that are saved within the database.

This only happens when the child records of a parent record are loaded, i.e. if a parent record is/was opened.
I suspect that the FormEngine JavaScript is responsible for getting the newly sorted uids in the correct order: during this search, the correct field is searched, but the different levels of records are not handled correctly.
This is my best guess as to why the wrong UIDs are passed to the DataHandler.

To reproduce add the following TCA/database definitions (or use the files that I added), add a few records and then re-sort the parent records with one of them being open.

"[...]/Configuration/TCA/tx_test_case.php":

<?php

return [
    'ctrl' => [
        'title' => 'IRRE sorting test',
        'label' => 'name'
    ],
    'columns' => [
        'name' => [
           'label' => 'Name',
            'config' => [
                'type' => 'input'
            ]
        ],
        'records' => [
            'label' => 'Parent IRRE records',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_test_parent',
                'foreign_sortby' => 'sorting',
                'appearance' => [
                    'useSortable' => true,
                    'enabledControls' => [
                        'sort' => true,
                        'dragdrop' => true
                    ]
                ]
            ]
        ]
    ],
    'types' => [
        0 => [
            'showitem' => 'name,records'
        ]
    ]
];

"[...]/Configuration/TCA/tx_test_parent.php":

<?php

return [
    'ctrl' => [
        'title' => 'IRRE sorting test parent record',
        'label' => 'name'
    ],
    'columns' => [
        'name' => [
            'label' => 'Name',
            'config' => [
                'type' => 'input'
            ]
        ],
        'children' => [
            'label' => 'Children IRRE records',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_test_child',
                'foreign_sortby' => 'sorting',
                'appearance' => [
                    'useSortable' => true,
                    'enabledControls' => [
                        'sort' => true,
                        'dragdrop' => true
                    ]
                ],
            ]
        ]
    ],
    'types' => [
        0 => [
            'showitem' => 'name,children'
        ]
    ]
];

"[...]/Configuration/TCA/tx_test_child.php":

<?php

return [
    'ctrl' => [
        'title' => 'IRRE sorting test child record',
        'label' => 'name'
    ],
    'columns' => [
        'name' => [
            'label' => 'Name',
            'config' => [
                'type' => 'input'
            ]
        ]
    ],
    'types' => [
        0 => [
            'showitem' => 'name'
        ]
    ]
];

"[...]/ext_tables.sql":

CREATE TABLE `tx_test_case` (
    `name` text,
    `records` text
);

CREATE TABLE `tx_test_parent` (
    `name` text,
    `children` text,
    `sorting` int(11) default 0 not null
);

CREATE TABLE `tx_test_child` (
    `name` text,
    `sorting` int(11) default 0 not null
);

Files

tx_test_child.php (363 Bytes) tx_test_child.php Johannes Schlier, 2020-11-09 15:37
tx_test_case.php (856 Bytes) tx_test_case.php Johannes Schlier, 2020-11-09 15:37
tx_test_parent.php (875 Bytes) tx_test_parent.php Johannes Schlier, 2020-11-09 15:37
ext_tables.sql (277 Bytes) ext_tables.sql Johannes Schlier, 2020-11-09 15:37
Actions #1

Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66933

Actions #2

Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66933

Actions #3

Updated by Gerrit Code Review almost 4 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/c/Packages/TYPO3.CMS/+/66933

Actions #4

Updated by Gerrit Code Review almost 4 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67253

Actions #5

Updated by Andreas Fernandez almost 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Gerrit Code Review almost 4 years ago

  • Status changed from Resolved to Under Review

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/c/Packages/TYPO3.CMS/+/66933

Actions #7

Updated by Andreas Fernandez almost 4 years ago

  • Status changed from Under Review to Resolved
Actions #8

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF