[BUGFIX] Failing group/select test changeElementSorting 78/28278/4
authorOliver Hader <oliver@typo3.org>
Tue, 11 Mar 2014 21:23:18 +0000 (22:23 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 14 Mar 2014 13:34:36 +0000 (14:34 +0100)
The workspace modify test "changeElementSorting" is failing
in the frontend for the TCA types "select" and "group".

The reason is, that the move placeholder is not selected
via the "uidInList" TypoScript property and thus removed
in PageRepository::versionOL().

To avoid that, "uidInList" gets extended to look-up
move placeholders if versioning preview is enabled.

Resolves: #56782
Releases: 6.2
Change-Id: Ifae30527bead02b38888f326de2615f6bfe35f5b
Reviewed-on: https://review.typo3.org/28278
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Thorsten Kahler
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Group/Modify/ActionTest.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/Select/Modify/ActionTest.php

index 513899a..a92210f 100644 (file)
@@ -7669,12 +7669,24 @@ class ContentObjectRenderer {
                        'ORDERBY' => '',
                        'LIMIT' => ''
                );
+               $considerMovePlaceholders = (
+                       $GLOBALS['TSFE']->sys_page->versioningPreview && $table !== 'pages'
+                       && !empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS'])
+                       && (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2
+               );
                if (trim($conf['uidInList'])) {
                        $listArr = GeneralUtility::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $conf['uidInList']));
-                       if (count($listArr) == 1) {
-                               $query .= ' AND ' . $table . '.uid=' . (int)$listArr[0];
+                       if (count($listArr) === 1) {
+                               $comparison = '=' . (int)$listArr[0];
+                       } else {
+                               $comparison = ' IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($listArr)) . ')';
+                       }
+                       // If move placeholder shall be considered, select via t3ver_move_id
+                       if ($considerMovePlaceholders) {
+                               $movePlaceholderComparison = $table . '.t3ver_state=' . VersionState::cast(VersionState::MOVE_PLACEHOLDER) .  ' AND ' . $table . '.t3ver_move_id' . $comparison;
+                               $query .= ' AND (' . $table . '.uid' . $comparison . ' OR ' . $movePlaceholderComparison .')';
                        } else {
-                               $query .= ' AND ' . $table . '.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($listArr)) . ')';
+                               $query .= ' AND ' . $table . '.uid' . $comparison;
                        }
                        $pid_uid_flag++;
                }
index fe3dc7c..8afce95 100644 (file)
@@ -79,7 +79,6 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Gro
         * @see DataSet/changeElementSorting.csv
         */
        public function changeElementSorting() {
-               $this->markTestSkipped('Core bug, see http://forge.typo3.org/issues/56782');
                parent::changeElementSorting();
                $this->assertAssertionDataSet('changeElementSorting');
 
index 471476c..5fc76e0 100644 (file)
@@ -79,7 +79,6 @@ class ActionTest extends \TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\Sel
         * @see DataSet/changeElementSorting.csv
         */
        public function changeElementSorting() {
-               $this->markTestSkipped('Core bug, see http://forge.typo3.org/issues/56782');
                parent::changeElementSorting();
                $this->assertAssertionDataSet('changeElementSorting');