[!!!][TASK] Remove l10n_mode noCopy 35/51235/3
authorOliver Hader <oliver@typo3.org>
Tue, 10 Jan 2017 11:47:54 +0000 (12:47 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Tue, 10 Jan 2017 19:04:24 +0000 (20:04 +0100)
The setting noCopy is removed from the list of possible values
of the TCA column property l10n_mode without any replacement.

Resolves: #79242
Releases: master
Change-Id: If6be272bd71f955a4f3a12c953ffedc55f7e07ac
Reviewed-on: https://review.typo3.org/51235
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Müllenhagen <christianmuellenhagen@yahoo.de>
Tested-by: Christian Müllenhagen <christianmuellenhagen@yahoo.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Migrations/TcaMigration.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-79242-RemoveL10n_modeNoCopy.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php
typo3/sysext/frontend/Tests/Unit/Page/PageRepositoryTest.php

index c58ebf3..ef201c4 100644 (file)
@@ -4623,7 +4623,7 @@ class DataHandler
                     $overrideValues[$fN] = '[' . $translateToMsg . '] ' . $row[$fN];
                 }
             } elseif (
-                ($fCfg['l10n_mode'] === 'exclude' || $fCfg['l10n_mode'] === 'noCopy' || $fCfg['l10n_mode'] === 'mergeIfNotBlank')
+                ($fCfg['l10n_mode'] === 'exclude' || $fCfg['l10n_mode'] === 'mergeIfNotBlank')
                     && $fN != $GLOBALS['TCA'][$Ttable]['ctrl']['languageField']
                     && $fN != $GLOBALS['TCA'][$Ttable]['ctrl']['transOrigPointerField']
              ) {
index 463afe3..c6e4188 100644 (file)
@@ -65,6 +65,7 @@ class TcaMigration
         $tca = $this->migrateShowIfRteOption($tca);
         $tca = $this->migrateWorkspacesOptions($tca);
         $tca = $this->migrateTranslationTable($tca);
+        $tca = $this->migrateL10nModeDefinitions($tca);
         $tca = $this->migrateRequestUpdate($tca);
         // @todo: if showitem/defaultExtras wizards[xy] is migrated to columnsOverrides here, enableByTypeConfig could be dropped
         return $tca;
@@ -929,6 +930,32 @@ class TcaMigration
     }
 
     /**
+     * Removes "noCopy" from possible settings for "l10n_mode" for each column.
+     *
+     * @param array $tca
+     * @return array Migrated TCA
+     */
+    protected function migrateL10nModeDefinitions(array $tca)
+    {
+        foreach ($tca as $table => &$tableDefinition) {
+            if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
+                continue;
+            }
+            foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
+                if (empty($fieldConfig['l10n_mode'])) {
+                    continue;
+                }
+                if ($fieldConfig['l10n_mode'] === 'noCopy') {
+                    unset($fieldConfig['l10n_mode']);
+                    $this->messages[] = 'The TCA setting \'noCopy\' was removed '
+                        . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'l10n_mode\']';
+                }
+            }
+        }
+        return $tca;
+    }
+
+    /**
      * Move ['ctrl']['requestUpdate'] to 'onChange => "reload"' of single fields
      *
      * @param array $tca Incoming TCA
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-79242-RemoveL10n_modeNoCopy.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-79242-RemoveL10n_modeNoCopy.rst
new file mode 100644 (file)
index 0000000..1309753
--- /dev/null
@@ -0,0 +1,36 @@
+.. include:: ../../Includes.txt
+
+==========================================
+Breaking: #79242 - Remove l10n_mode noCopy
+==========================================
+
+See :issue:`79242`
+
+Description
+===========
+
+The setting noCopy is removed from the list of possible values of the TCA column
+property l10n_mode without any replacement.
+
+
+Impact
+======
+
+Previously noCopy prevented that values of the parent language record are copied
+to a particular localization when this was created. Now, this value is duplicated once during the creation of the localized record and has to be cleaned manually if required.
+
+
+Affected Installations
+======================
+
+All having `$GLOBALS['TCA'][<table-name>]['columns'][<column-name>]['l10n_mode']`
+set to `noCopy`.
+
+
+Migration
+=========
+
+Remove setting `$GLOBALS['TCA'][<table-name>]['columns'][<column-name>]['l10n_mode']`
+if it is set to `noCopy`.
+
+.. index:: TCA
\ No newline at end of file
index 0f077a3..a776981 100644 (file)
@@ -1967,6 +1967,46 @@ class TcaMigrationTest extends \TYPO3\CMS\Components\TestingFramework\Core\UnitT
     /**
      * @return array
      */
+    public function migrateL10nModeDefinitionsDataProvider()
+    {
+        return [
+            'remove l10n_mode noCopy' => [
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aColumn' => [
+                                'l10n_mode' => 'noCopy',
+                            ],
+                        ],
+                    ],
+                ],
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aColumn' => [
+                            ],
+                        ],
+                    ],
+                ]
+            ],
+        ];
+    }
+
+    /**
+     * @param array $givenConfig
+     * @param array $expectedConfig
+     * @test
+     * @dataProvider migrateTranslationTableDataProvider
+     */
+    public function migrateL10nModeDefinitions(array $givenConfig, array $expectedConfig)
+    {
+        $subject = new TcaMigration();
+        $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
+    }
+
+    /**
+     * @return array
+     */
     public function migrateMovesRequestUpdateCtrlFieldToColumnsDataProvider()
     {
         return [
index c9db506..3a73a2e 100644 (file)
@@ -116,10 +116,6 @@ class PageRepositoryTest extends \TYPO3\CMS\Components\TestingFramework\Core\Uni
                 // no l10n_mode set
                 'config' => ['type' => 'input'],
             ],
-            'noCopy' => [
-                'l10n_mode' => 'noCopy',
-                'config' => ['type' => 'input'],
-            ],
             'prefixLangTitle' => [
                 'l10n_mode' => 'prefixLangTitle',
                 'config' => ['type' => 'input'],
@@ -154,9 +150,6 @@ class PageRepositoryTest extends \TYPO3\CMS\Components\TestingFramework\Core\Uni
             ['mergeIfNotBlank_group', 'fake_table', '0',      false, 'mergeIfNotBlank on group is not merged with "0"'],
             ['mergeIfNotBlank_group', 'fake_table', 'foobar', true,  'mergeIfNotBlank on group is merged with non-empty string'],
 
-            ['noCopy',                'fake_table', 'foobar', true,  'noCopy is merged with non-empty string'],
-            ['noCopy',                'fake_table', '',       true,  'noCopy is merged with empty string'],
-
             ['prefixLangTitle',       'fake_table', 'foobar', true,  'prefixLangTitle is merged with non-empty string'],
             ['prefixLangTitle',       'fake_table', '',       true,  'prefixLangTitle is merged with empty string'],
         ];