[BUGFIX] DataMapProcessor does not exclude workspace versions 47/51647/2
authorOliver Hader <oliver@typo3.org>
Sun, 12 Feb 2017 20:26:58 +0000 (21:26 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 14 Feb 2017 06:14:21 +0000 (07:14 +0100)
DataMapProcessor, used to resolve and handle the language synchronization
feature, does not exclude workspace versions correctly. That's why it
might happen, that inline records are not correctly synchronized in the
live workspace if translations exist in any workspace.

Resolves: #79769
Releases: master
Change-Id: Id1d724ae38aeddefbe82a316624a75315d1a93f1
Reviewed-on: https://review.typo3.org/51647
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php

index 999e39b..01dd6b0 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
@@ -537,7 +538,8 @@ class DataMapProcessor
             ->getQueryBuilderForTable($tableName);
         $queryBuilder->getRestrictions()
             ->removeAll()
-            ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
+            ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class, $this->backendUser->workspace, false));
         $statement = $queryBuilder
             ->select(...array_values($fieldNames))
             ->from($tableName)
@@ -666,7 +668,8 @@ class DataMapProcessor
             ->getQueryBuilderForTable($tableName);
         $queryBuilder->getRestrictions()
             ->removeAll()
-            ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
+            ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class, $this->backendUser->workspace, false));
 
         $zeroParameter = $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT);
         $idsParameter = $queryBuilder->createNamedParameter($ids, Connection::PARAM_INT_ARRAY);