#93817TCA unique evaluation fails for unchanged value in default language with l10n_mode=exclude
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
The line
&& $GLOBALS['TCA'][$table]['columns'][$field]['languageField'] ?? '' !== '') {
needs to be
&& $GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? '' !== '') {