Project

General

Profile

Actions

Bug #89271

open

Inline (IRRE) records are not kept in sync on record save

Added by Markus Klein over 4 years ago. Updated 9 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2019-09-25
Due date:
% Done:

0%

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

Description

Setup description

Table "project"

  • translatable
  • IRRE field "assignments" (l10n_mode = exclude)

Table "assignment"

  • not translatable
  • boolean flag "checked" (default 0)

Reproduction

  1. Create a project record and add an assignment in default language => project uid = 1, assignment record uid = 23
  2. Create a translation of the project record => project uid = 2, assignment record uid = 24 (assignments duplicated for the translation, but have no connection to the parent's assignment 23)
  3. Edit the project again (uid 23) and change the "checked" field to "1" in the assignment
  4. Save the project

Expected behaviour

The assignment associated with the translated project has a value of "1" for the "checked" field.
(The change in the default language has to be mirrored to the translations due to l10n_mode = exclude)

Seen behaviour

The value of the "checked" field of the assignment of the translated project stays unchanged (=0)

Impact

The editor in the Backend changes information in an inline child and wonders why things are not updated in the Frontend for translations.
The workaround for the editor would be to open each and every translation of the parent (project) and save it once.

Analysis

The DataHandler runs a preprocessing of the datamap with the DataMapProcessor.
In this step all inline children of the translations are purged and regenerated based on the default record's children.
In this phase though, the changed child (assignment) is not yet persisted. Hence, the new translation's children are generated based on old data.

We see two possible solutions:

  1. Merge the information of the updated assignment from the datamap with the values currently persisted in the database. (this might be very tricky)
  2. Defer the synchronization of the IRRE children of translations until the main datamap processing has been completed. (this is most like the way to go)

Related issues 3 (2 open1 closed)

Related to TYPO3 Core - Bug #88452: TCA field type inline ignores l10n_mode "exclude"New2019-05-28

Actions
Related to TYPO3 Core - Bug #87640: Keep language reference for associated l10n_mode=exclude childrenClosed2019-02-04

Actions
Related to TYPO3 Core - Bug #98050: Non translatable inline records only updates on second save.Under Review2022-07-28

Actions
Actions #1

Updated by Markus Klein over 4 years ago

  • Related to Bug #88452: TCA field type inline ignores l10n_mode "exclude" added
Actions #2

Updated by Markus Klein over 4 years ago

  • Related to Bug #87640: Keep language reference for associated l10n_mode=exclude children added
Actions #3

Updated by Oliver Hader over 4 years ago

  • Status changed from New to Needs Feedback
  • Priority changed from Must have to Should have
  • How are both tables configured TCA-wise? It is difficult to guess how it's done...
  • Which field should/might be used in order to determine that assignments with uids 23 and 24 actually are belonging together?
Actions #4

Updated by Markus Klein over 4 years ago

  • Status changed from Needs Feedback to New

TCA Project:

return [
    'ctrl' => [
        'title' => 'project',
        'label' => 'name',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'cruser_id' => 'cruser_id',
        'languageField' => 'sys_language_uid',
        'transOrigPointerField' => 'l10n_parent',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'delete' => 'deleted',
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        'default_sortby' => 'ORDER BY name',
        'searchFields' => '',
        'iconfile' => 'EXT:ext/Resources/Public/Icons/Tables/project.svg',
    ],
...
    'columns' => [
        'site_assignment' => [
            'exclude' => false,
            'l10n_mode' => 'exclude',
            'label' => 'assignment',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_ext_domain_model_projectsiteassignment',
                'foreign_field' => 'project',
                'appearance' => [
                    'collapseAll' => true,
                    'newRecordLinkAddTitle' => false,
                ],
            ],
        ],
...
    ],
];

TCA Table assignment:

return [
    'ctrl' => [
        'title'    => 'projectsiteassignment',
        'label' => 'category',
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'cruser_id' => 'cruser_id',
        'iconfile' => 'EXT:ext/Resources/Public/Icons/Tables/project.svg'
    ],
...
    'columns' => [
        'project' => [
            'exclude' => false,
            'label' => 'project',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_ext_domain_model_project',
                'foreign_table_where' => 'AND tx_ext_domain_model_project.pid=###CURRENT_PID### AND tx_ext_domain_model_project.sys_language_uid IN (-1,0) ORDER BY tx_ext_domain_model_project.name',
                'enableMultiSelectFilterTextfield' => true,
                'minitems' => 1,
                'maxitems' => 1,
            ],
        ],
        'prestige_reference' => [
            'exclude' => false,
            'label' => 'prestige_reference',
            'config' => [
                'type' => 'check',
                'items' => [
                    '1' => [
                        '0' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.enabled'
                    ]
                ],
                'default' => 0
            ]
        ],
...
    ],

There is no need to have a relation between the assignment records! Those created for the translation of a project are only generated because the core does this ("record unrolling" how I like to call it). This is not technically needed for the use case, where it would suffice to store the assignment once for a project (no matter how it is translated).

In terms of "record unrolling" the core behaviour is clear and okay (even though it wastes some uids in DB due to the delete and re-create), but there is no other possibility to keep the things in sync. But, the sync has to happen after the assignments in the original language have been persisted not before.

Actions #5

Updated by Gerrit Code Review about 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/+/62871

Actions #6

Updated by Dominik Heun almost 4 years ago

Hi guys,
just wanted to ask if we can expect the patch in the next releases?

Actions #7

Updated by Paul Beck over 3 years ago

I can confirm this issue in the latest 9 LTS version. It's very annoying to explain to the users. l10n_mode exclude must work as exptected.

Actions #8

Updated by Martin R. Krause over 3 years ago

Can confirm for v9LTS. This is pretty disturbing. There has to be an option to IRRE to NOT be copied when a translation get created. Especially for table pages. Having a relation to pages, which used to have no translation at all is a common design pattern for structured data.

Actions #9

Updated by Vladimir Falcon almost 3 years ago

I can confirm this problem in TYPO3 V9.5.26 as well.

The fields types inline and group n:m with MM relations do not respect 'l10n_mode' => 'exclude' setting. Data ist just lost upon translation.

Actions #10

Updated by Gerrit Code Review over 2 years ago

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

Actions #11

Updated by Anonymous about 1 year ago

I can confirm in 11.5.22 too.

Actions #12

Updated by JAKOTA Design Group GmbH about 1 year ago

  • Related to Bug #98050: Non translatable inline records only updates on second save. added
Actions #13

Updated by Gerrit Code Review 9 months ago

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

Actions

Also available in: Atom PDF