[BUGFIX] mergeIfNotBlank does not work for recordTitle and tcaType 50/42050/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 28 Jul 2015 16:21:00 +0000 (18:21 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 28 Jul 2015 17:47:38 +0000 (19:47 +0200)
If a field is TCA config is set to l10n_mode=mergeIfNotBlank, the
value from the default language record is used as fallback if the
overlay value is blank.
Apart from the fact that "mergeIfNotBlank" is very misleading
wording, this is not handled correctly at two places in the backend.

Resolves: #68592
Releases: master
Change-Id: If112cbb5cc534a4c2d3379832c37e6bbe3def4d8
Reviewed-on: http://review.typo3.org/42050
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Form/Container/AbstractContainer.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index 7b9082f..5e8edd3 100644 (file)
@@ -160,11 +160,9 @@ abstract class AbstractContainer extends AbstractNode {
        protected function overrideTypeWithValueFromDefaultLanguageRecord($table, array $row, $field, $fieldConf) {
                $value = $row[$field];
                if (is_array($this->defaultLanguageData[$table . ':' . $row['uid']])) {
-                       // @todo: Is this a bug? Currently the field from default lang is picked in mergeIfNotBlank mode if the
-                       // @todo: default value is not empty, but imho it should only be picked if the language overlay record *is* empty?!
                        if (
                                $fieldConf['l10n_mode'] === 'exclude'
-                               || $fieldConf['l10n_mode'] === 'mergeIfNotBlank' && trim($this->defaultLanguageData[$table . ':' . $row['uid']][$field]) !== ''
+                               || ($fieldConf['l10n_mode'] === 'mergeIfNotBlank' && trim($row[$field] === ''))
                        ) {
                                $value = $this->defaultLanguageData[$table . ':' . $row['uid']][$field];
                        }
index 30f93e4..910086e 100755 (executable)
@@ -2058,7 +2058,7 @@ class BackendUtility {
                        $l10n_mode = isset($GLOBALS['TCA'][$originalTable]['columns'][$field]['l10n_mode'])
                                ? $GLOBALS['TCA'][$originalTable]['columns'][$field]['l10n_mode']
                                : '';
-                       if ($l10n_mode === 'exclude' || ($l10n_mode === 'mergeIfNotBlank' && trim($originalRow[$field]) !== '')) {
+                       if ($l10n_mode === 'exclude' || ($l10n_mode === 'mergeIfNotBlank' && trim($row[$field]) === '')) {
                                $row[$field] = $originalRow[$field];
                        }
                }