Issue Bug Closed

#68624Invalid handling of TCA config "l10n_mode" in the backend for "mergeIfNotBlank"

Radu Mogos 07/29/15, 16:45 updated 10/23/17, 21:48

Description

I think i might have found a small backend bug for the list module, for records that are localised and their TCA config is set to “l10n_mode” => “mergeIfNotBlank”.

For an extbase model we have the following TCA config for the “name” field:

        'name' => array(
            'exclude' => 0,
            'l10n_mode' => 'mergeIfNotBlank',
            'label' => 'LLL:EXT:fhhwebsite/Resources/Private/Language/locallang_db.xml:tx_fhhwebsite_domain_model_timepiece.name',
            'config' => array(
                'type' => 'input',
                'size' => 32,
                'max' => 255,
                'eval' => 'trim,required'
            ),
        ),

Please note the setting “l10n_mode” with the value “mergeIfNotBlank”.

This setting gives me the following list view in the backend, which is wrong:
!bad.png!
The following is what I should see:
good.png

This happens because the call replaceL10nModeFields inside TYPO3\CMS\Backend\Utility\BackendUtility is wrong…

The line concerned is 1956 (in typo3 6.2.13)
Currently this is what the method is doing:

if ($l10n_mode === 'exclude' || ($l10n_mode === 'mergeIfNotBlank' && trim($originalRow[$field]) !== '')) {
  $row[$field] = $originalRow[$field];
}

while it should do the opposite

if ($l10n_mode === 'exclude' || ($l10n_mode === 'mergeIfNotBlank' && trim($row[$field]) == '')) {
  $row[$field] = $originalRow[$field];
}

$originalRow contains the parent data, so the “default” language values, while $row contains the localised version. So if the setting “mergeIfNotBlank” is set, we should check if the localised row $field is empty, if it is then we get the value from the default language, so we compare the localised version, not the original one.

At least this is what I understood from the official docs that should be the behaviour of “mergeIfNotBlank”: http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Index.html#l10n-mode

Reviews 1