[BUGFIX] Determine default language as origin correctly 00/57700/3
authorNicole Cordes <typo3@cordes.co>
Fri, 27 Jul 2018 11:44:11 +0000 (13:44 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 5 Aug 2018 08:50:11 +0000 (10:50 +0200)
Resolves: #85638
Releases: master, 8.7
Change-Id: I98ecaef360d5a27e965cbb67c5719729054b9c37
Reviewed-on: https://review.typo3.org/57700
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Domain/Repository/Localization/LocalizationRepository.php
typo3/sysext/backend/Tests/Functional/Controller/Page/Fixtures/tt_content-danish-language.xml
typo3/sysext/backend/Tests/Functional/Controller/Page/LocalizationControllerTest.php
typo3/sysext/backend/Tests/Functional/Domain/Repository/Localization/LocalizationRepositoryTest.php

index 2ed9c22..474edac 100644 (file)
@@ -67,7 +67,7 @@ class LocalizationRepository
                     $queryBuilder->quoteIdentifier('tt_content_orig.uid')
                 )
             )
-            ->join(
+            ->leftJoin(
                 'tt_content_orig',
                 'sys_language',
                 'sys_language',
index 7d12f98..142041c 100644 (file)
@@ -5,6 +5,7 @@
                <pid>1</pid>
                <sys_language_uid>1</sys_language_uid>
                <l18n_parent>1</l18n_parent>
+               <l10n_source>1</l10n_source>
                <deleted>0</deleted>
                <t3ver_oid>0</t3ver_oid>
                <t3ver_wsid>0</t3ver_wsid>
@@ -16,6 +17,7 @@
                <pid>1</pid>
                <sys_language_uid>1</sys_language_uid>
                <l18n_parent>2</l18n_parent>
+               <l10n_source>2</l10n_source>
                <deleted>0</deleted>
                <t3ver_oid>0</t3ver_oid>
                <t3ver_wsid>0</t3ver_wsid>
                <pid>1</pid>
                <sys_language_uid>1</sys_language_uid>
                <l18n_parent>3</l18n_parent>
+               <l10n_source>3</l10n_source>
                <deleted>0</deleted>
                <t3ver_oid>0</t3ver_oid>
                <t3ver_wsid>0</t3ver_wsid>
                <header>Test indhold 3</header>
                <sorting>3</sorting>
        </tt_content>
-</dataset>
\ No newline at end of file
+</dataset>
index 229711e..4950181 100644 (file)
@@ -392,6 +392,40 @@ class LocalizationControllerTest extends \TYPO3\TestingFramework\Core\Functional
     /**
      * @test
      */
+    public function defaultLanguageIsFoundAsOriginLanguage()
+    {
+        $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/backend/Tests/Functional/Controller/Page/Fixtures/tt_content-danish-language.xml');
+
+        // Create another content element in default language
+        $data = [
+            'tt_content' => [
+                'NEW123456' => [
+                    'sys_language_uid' => 0,
+                    'header' => 'New content element',
+                    'pid' => 1,
+                    'colPos' => 0,
+                ],
+            ],
+        ];
+        $dataHandler = new DataHandler();
+        $dataHandler->start($data, []);
+        $dataHandler->process_datamap();
+        $dataHandler->process_cmdmap();
+
+        $request = (new ServerRequest())->withQueryParams([
+            'pageId' => 1, // page uid, the records are stored on
+            'colPos' => 0,
+            'languageId' => 1  // current language id
+        ]);
+        $response = new Response();
+
+        $this->subject->getUsedLanguagesInPageAndColumn($request, $response);
+        $this->assertThat($response->getBody(), $this->stringContains('"uid":0'));
+    }
+
+    /**
+     * @test
+     */
     public function recordLocalizeSummaryRespectsWorkspaceEncapsulationForDeletedRecords()
     {
         // Delete record 2 within workspace 1
index 70d42be..4c82e8a 100644 (file)
@@ -49,50 +49,56 @@ class LocalizationRepositoryTest extends \TYPO3\TestingFramework\Core\Functional
                 1,
                 0,
                 0,
-                false
+                false,
             ],
             'connected mode translated from default language' => [
                 1,
                 0,
                 1,
-                false
+                [
+                    'sys_language_uid' => 0,
+                ],
             ],
             'connected mode translated from non default language' => [
                 1,
                 0,
                 2,
                 [
-                    'sys_language_uid' => 1
-                ]
+                    'sys_language_uid' => 1,
+                ],
             ],
             'free mode translated from default language' => [
                 2,
                 0,
                 1,
-                false
+                [
+                    'sys_language_uid' => 0,
+                ],
             ],
             'free mode translated from non default language' => [
                 2,
                 0,
                 2,
                 [
-                    'sys_language_uid' => 1
-                ]
+                    'sys_language_uid' => 1,
+                ],
             ],
             'free mode copied from another page translated from default language' => [
                 3,
                 0,
                 1,
-                false
+                [
+                    'sys_language_uid' => 0,
+                ],
             ],
             'free mode copied from another page translated from non default language' => [
                 3,
                 0,
                 2,
                 [
-                    'sys_language_uid' => 1
-                ]
-            ]
+                    'sys_language_uid' => 1,
+                ],
+            ],
         ];
     }
 
@@ -118,44 +124,44 @@ class LocalizationRepositoryTest extends \TYPO3\TestingFramework\Core\Functional
                 1,
                 0,
                 0,
-                0
+                0,
             ],
             'connected mode translated from default language' => [
                 1,
                 0,
                 1,
-                2
+                2,
             ],
             'connected mode translated from non default language' => [
                 1,
                 0,
                 2,
-                1
+                1,
             ],
             'free mode translated from default language' => [
                 2,
                 0,
                 1,
-                1
+                1,
             ],
             'free mode translated from non default language' => [
                 2,
                 0,
                 2,
-                1
+                1,
             ],
             'free mode copied from another page translated from default language' => [
                 3,
                 0,
                 1,
-                1
+                1,
             ],
             'free mode copied from another page translated from non default language' => [
                 3,
                 0,
                 2,
-                1
-            ]
+                1,
+            ],
         ];
     }
 
@@ -178,8 +184,8 @@ class LocalizationRepositoryTest extends \TYPO3\TestingFramework\Core\Functional
                 1,
                 0,
                 [
-                    ['uid' => 298]
-                ]
+                    ['uid' => 298],
+                ],
             ],
             'from language 1 to 2 connected mode' => [
                 1,
@@ -187,36 +193,36 @@ class LocalizationRepositoryTest extends \TYPO3\TestingFramework\Core\Functional
                 2,
                 1,
                 [
-                    ['uid' => 300]
-                ]
+                    ['uid' => 300],
+                ],
             ],
             'from language 0 to 1 free mode' => [
                 2,
                 0,
                 1,
                 0,
-                []
+                [],
             ],
             'from language 1 to 2 free mode' => [
                 2,
                 0,
                 2,
                 1,
-                []
+                [],
             ],
             'from language 0 to 1 free mode copied' => [
                 3,
                 0,
                 1,
                 0,
-                []
+                [],
             ],
             'from language 1 to 2 free mode  mode copied' => [
                 3,
                 0,
                 2,
                 1,
-                []
+                [],
             ],
         ];
     }