Project

General

Profile

Actions

Bug #98050

open

Non translatable inline records only updates on second save.

Added by JAKOTA Design Group GmbH over 1 year ago. Updated 10 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
Start date:
2022-07-28
Due date:
% Done:

0%

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

Description

Hi,

I'm sorry if this gets a bit long, but I have no idea how to describe this any other way.

Consider the following setup:

Main table is translatable tx_demo_domain_model_main and has inline records of tx_demo_domain_model_sub which are not translatable in it self and should only be changeable in the default language of main.

return [
  'ctrl' => [
    'title' => 'Main',
    'label' => 'title',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'sortby' => 'sorting',
    'versioningWS' => true,
    'languageField' => 'sys_language_uid',
    'transOrigPointerField' => 'l10n_parent',
    'transOrigDiffSourceField' => 'l10n_diffsource',
    'delete' => 'deleted',
    'enablecolumns' => [
      'disabled' => 'hidden',
      'starttime' => 'starttime',
      'endtime' => 'endtime',
    ],
    'searchFields' => 'title',
    'iconfile' => 'main.svg',

  ],
  'types' => [
    '1' => [
      'showitem' => '
        title, subs, 
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language, sys_language_uid, l10n_parent, l10n_diffsource, 
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime
      ',
    ],
  ],
  'columns' => [
    'sys_language_uid' => [
      'exclude' => true,
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
      'config' => [
        'type' => 'language',
      ],
    ],
    'l10n_parent' => [
      'displayCond' => 'FIELD:sys_language_uid:>:0',
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
      'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'default' => 0,
        'items' => [
          ['', 0],
        ],
        'foreign_table' => 'tx_demo_domain_model_main',
        'foreign_table_where' => 'AND {#tx_demo_domain_model_main}.{#pid}=###CURRENT_PID### AND {#tx_demo_domain_model_main}.{#sys_language_uid} IN (-1,0)',
      ],
    ],
    'l10n_diffsource' => [
      'config' => [
        'type' => 'passthrough',
      ],
    ],
    'hidden' => [
      'exclude' => true,
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
      'config' => [
        'type' => 'check',
        'renderType' => 'checkboxToggle',
        'items' => [
          [
            0 => '',
            1 => '',
            'invertStateDisplay' => true,
          ],
        ],
      ],
    ],
    'starttime' => [
      'exclude' => true,
      'l10n_mode' => 'exclude',
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
      'config' => [
        'type' => 'input',
        'renderType' => 'inputDateTime',
        'eval' => 'datetime,int',
        'default' => 0,
        'behaviour' => [
          'allowLanguageSynchronization' => true,
        ],
      ],
    ],
    'endtime' => [
      'exclude' => true,
      'l10n_mode' => 'exclude',
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
      'config' => [
        'type' => 'input',
        'renderType' => 'inputDateTime',
        'eval' => 'datetime,int',
        'default' => 0,
        'range' => [
          'upper' => mktime(0, 0, 0, 1, 1, 2038),
        ],
        'behaviour' => [
          'allowLanguageSynchronization' => true,
        ],
      ],
    ],
    'title' => [
      'exclude' => true,
      'label' => 'title',
      'config' => [
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim,required',
        'default' => '',
      ],
    ],

    'subs' => [
      'exclude' => true,
      'l10n_mode' => 'exclude',
      'label' => 'Sub',
      'config' => [
        'type' => 'inline',
        'foreign_table' => 'tx_demo_domain_model_sub',
        'foreign_field' => 'main',
        'maxitems' => 9999,
        'appearance' => [
          'collapseAll' => 1,
          'levelLinksPosition' => 'top',
          'showSynchronizationLink' => 1,
          'showPossibleLocalizationRecords' => 1,
          'showAllLocalizationLink' => 1,
        ],
      ],
    ],
  ],
];

Here the setup of tx_demo_domain_model_sub


return [
  'ctrl' => [
    'title' => 'Sub',
    'label' => 'price',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'default_sortby' => 'price ASC',
    'versioningWS' => true,
    'delete' => 'deleted',
    'enablecolumns' => [
      'disabled' => 'hidden',
      'starttime' => 'starttime',
      'endtime' => 'endtime',
    ],
    'searchFields' => '',
    'iconfile' => 'sub.gif',
  ],
  'types' => [
    '1' => [
      'showitem' => '
        price, 
        --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access, hidden, starttime, endtime
      ',
    ],
  ],
  'columns' => [
    'hidden' => [
      'exclude' => true,
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
      'config' => [
        'type' => 'check',
        'renderType' => 'checkboxToggle',
        'items' => [
          [
            0 => '',
            1 => '',
            'invertStateDisplay' => true,
          ],
        ],
      ],
    ],
    'starttime' => [
      'exclude' => true,
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
      'config' => [
        'type' => 'input',
        'renderType' => 'inputDateTime',
        'eval' => 'datetime,int',
        'default' => 0,
        'behaviour' => [
          'allowLanguageSynchronization' => true,
        ],
      ],
    ],
    'endtime' => [
      'exclude' => true,
      'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
      'config' => [
        'type' => 'input',
        'renderType' => 'inputDateTime',
        'eval' => 'datetime,int',
        'default' => 0,
        'range' => [
          'upper' => mktime(0, 0, 0, 1, 1, 2038),
        ],
        'behaviour' => [
          'allowLanguageSynchronization' => true,
        ],
      ],
    ],
    'price' => [
      'exclude' => true,
      'label' => 'price',
      'config' => [
        'type' => 'input',
        'size' => 30,
        'eval' => 'double2',
      ],
    ],
    'main' => [
      'config' => [
        'type' => 'passthrough',
      ],
    ],
  ],
];

Now create a main record and add sub records.
If the main record is now translated everything is fine.

But if now the main record with language id 0 is opened, the value of one the sub records is changed, and you hit save.
This has no effect on the value of the sub records for the main record language id 1.

Only if you click save for main record language id 0 again this change is also made for the records language 1.

Even worse, this the sub record value always get the old value of the default language on save.

Which looks like this

1. Step create


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'

tx_demo_domain_model_sub
id, price, main
1,  1.5,   1

2. Step translate


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'
2,  1,        1,      'second language'

tx_demo_domain_model_sub
id, price, main
1,  1.5,   1
2,  1.5,   2

3. Step edit and save


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'
2,  1,        1,      'second language'

tx_demo_domain_model_sub
id, price, main
1,  2,     1
2,  1.5,   2

The price in changed but only for the default language sub record

4. Step just save again


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'
2,  1,        1,      'second language'

tx_demo_domain_model_sub
id, price, main
1,  2,     1
2,  2,     2

Now also the sub record for the second language is updated.

5. Step edit again


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'
2,  1,        1,      'second language'

tx_demo_domain_model_sub
id, price, main
1,  3,     1
2,  2,     2

6. Step edit again


tx_demo_domain_model_main
id, language, parent, title
1,  0.        0,      'default language'
2,  1,        1,      'second language'

tx_demo_domain_model_sub
id, price, main
1,  4,     1
2,  3,     2

As you can see in step 5 and 6 the translated record is updated to the old value of the default language but not to the new one.


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #89271: Inline (IRRE) records are not kept in sync on record saveUnder Review2019-09-25

Actions
Actions #1

Updated by JAKOTA Design Group GmbH over 1 year ago

After digging in the code for a while I found that the translated inline record is not updated but deleted and created as a new one instead.

And in this process the DataHandler gets the default language record from the DB before the changed values are saved.

Actions #3

Updated by JAKOTA Design Group GmbH over 1 year ago

  • Related to Bug #89271: Inline (IRRE) records are not kept in sync on record save added
Actions #4

Updated by Gerrit Code Review 10 months ago

  • Status changed from New to Under Review

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