Project

General

Profile

Actions

Bug #93817

closed

TCA unique evaluation fails for unchanged value in default language with l10n_mode=exclude

Added by Christoph Lehmann over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2021-03-25
Due date:
% Done:

100%

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

Description

This is my field

        'nr' => [
            'exclude' => true,
            'l10n_mode' => 'exclude',
            'label' => $ll . 'fields.nr',
            'config' => [
                'type' => 'input',
                'size' => 5,
                'max' => 5,
                'range' => array(
                    'upper' => 99999
                ),
                'placeholder' => 'xxxxx',
                'eval' => 'num, nospace, trim, unique'
            ]
        ],

This is my ctrl:

    'ctrl' => [
...
        'languageField' => 'sys_language_uid',
        'transOrigDiffSourceField' => 'l10n_diffsource',
        'transOrigPointerField' => 'l10n_parent',
    ],

This is fine so far.

How to reproduce:

  • Create a record
  • fill nr with 12345
  • Translate the record

The translation get the same value

  • Edit the record in default language again

=> Issue: The value for nr changes, because the sql statement for the unique check does not respect 'languageField' in ctrl section.

After saving i see a warning:

4: The value of the field "nr" has been changed from "12345" to "123450" as it is required to be unique.

The bug was introduced in #87038

See https://forge.typo3.org/projects/typo3cms-core/repository/1749/revisions/08ae979e21c2004fe055c2ceaed97aea5e3fdb5e/diff/typo3/sysext/core/Classes/DataHandling/DataHandler.php

The line

&& $GLOBALS['TCA'][$table]['columns'][$field]['languageField'] ?? '' !== '') {

needs to be

&& $GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? '' !== '') {

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #87038: Unique evaluation does not work with l10n_mode=exclude after editing original record againClosedBenni Mack2018-11-29

Actions
Actions

Also available in: Atom PDF