Issue Bug Under Review

#98050Non translatable inline records only updates on second save.

JAKOTA Design Group GmbH 07/28/22, 20:27 updated 11/13/26, 19:24

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.

Reviews 1

History 48

  1. JAKOTA Design Group GmbH commented <span data-processor="relativetime" data-value="2022-07-31T14:29:31+00:00" > 07/31/22, 14:29 </span>

    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.