[FOLLOWUP][BUGFIX] Exception when setting "language" to "all" for content 62/51962/2
authorOliver Hader <oliver@typo3.org>
Mon, 6 Mar 2017 09:06:15 +0000 (10:06 +0100)
committerNicole Cordes <typo3@cordes.co>
Mon, 6 Mar 2017 22:17:38 +0000 (23:17 +0100)
The initial change just hid a misbehavior when dealing with a content
element that was defined for the non-existing "all language". In this
case no localizations are possible and the data-map item shall not be
considered at all. This change makes the exception on language "-1"
more explicit and does not hide these side-effects.

Besides that, the functional tests were extended to check the complete
scenario for the defined language to be tested in the frontend.

Change-Id: I336e0e5c3994e21b9b8a17818b3dc0ab1c2a1b3a
Resolves: #79853
Releases: master
Reviewed-on: https://review.typo3.org/51962
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Joerg Kummer <service@enobe.de>
Tested-by: Joerg Kummer <service@enobe.de>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php
typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/ActionTest.php
typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/createContentForLanguageAll.csv

index f26f031..b55057f 100644 (file)
@@ -162,6 +162,11 @@ class DataMapProcessor
                 $fieldNames
             );
 
+            // elements using "all language" cannot be localized
+            if ($item->getLanguage() === -1) {
+                unset($item);
+                continue;
+            }
             // must be any kind of localization and in connected mode
             if ($item->getLanguage() > 0 && empty($item->getParent())) {
                 unset($item);
@@ -197,10 +202,6 @@ class DataMapProcessor
             foreach ($this->filterItemsByType($type) as $item) {
                 foreach ($item->getApplicableScopes() as $scope) {
                     $fromId = $item->getIdForScope($scope);
-                    if (empty($fromId)) {
-                        continue;
-                    }
-
                     $fieldNames = $this->getFieldNamesForItemScope($item, $scope, !$item->isNew());
                     $this->synchronizeTranslationItem($item, $fieldNames, $fromId);
                 }
index ca0219b..44d14bd 100644 (file)
@@ -54,7 +54,7 @@ class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\A
 
         $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageIdSecond)->getResponseSections();
         $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
-            ->setTable(self::TABLE_Content)->setField('header')->setValues('Language set to all'));
+            ->setTable(self::TABLE_Content)->setField('header')->setValues('Language set to all', '[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1'));
     }
 
     /**
index 0cfbbce..55680d4 100644 (file)
@@ -1,9 +1,9 @@
-tt_content,,,,,,,,,,,,,,
-,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,l10n_source,t3_origuid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header
-,297,89,256,0,0,0,0,0,0,0,0,0,0,Regular Element #1
-,298,89,512,0,0,0,0,0,0,0,0,0,0,Regular Element #2
-,299,89,768,0,0,0,0,0,0,0,0,0,0,Regular Element #3
-,300,89,1024,0,1,299,299,299,0,0,0,0,0,[Translate to Dansk:] Regular Element #3
-,301,89,384,0,1,297,297,297,0,0,0,0,0,[Translate to Dansk:] Regular Element #1
-,302,89,448,0,2,297,301,301,0,0,0,0,0,[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1
-,303,89,128,0,-1,0,0,0,0,0,0,0,0,Language set to all
\ No newline at end of file
+tt_content
+,uid,pid,sorting,deleted,sys_language_uid,l18n_parent,l10n_source,t3_origuid,t3ver_wsid,t3ver_state,t3ver_stage,t3ver_oid,t3ver_move_id,header,l10n_state
+,297,89,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #1",\NULL
+,298,89,512,0,0,0,0,0,0,0,0,0,0,"Regular Element #2",\NULL
+,299,89,768,0,0,0,0,0,0,0,0,0,0,"Regular Element #3",\NULL
+,300,89,1024,0,1,299,299,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3",\NULL
+,301,89,384,0,1,297,297,297,0,0,0,0,0,"[Translate to Dansk:] Regular Element #1",\NULL
+,302,89,448,0,2,297,301,301,0,0,0,0,0,"[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1",\NULL
+,303,89,128,0,-1,0,0,0,0,0,0,0,0,"Language set to all",\NULL