From aaca3e997fe554c67f1c7e1d71775d9c718be90b Mon Sep 17 00:00:00 2001
From: Timo Webler <timo.webler@dkd.de>
Date: Wed, 25 Apr 2012 17:07:31 +0200
Subject: [PATCH] [BUGFIX] Add workspace overlay for fetched records.

Call workspace overlay to resolve the right uid for
move-placeholder.

Change-Id: I6af65fcda1b1fffe72dfbc314976e42f30120d71
Fixes: #36573
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/10759
Reviewed-by: Sascha Egerer
Tested-by: Sascha Egerer
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
---
 typo3/sysext/backend/Classes/Form/DataPreprocessor.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/typo3/sysext/backend/Classes/Form/DataPreprocessor.php b/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
index a22eae0708b7..f7db268cd15e 100644
--- a/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
+++ b/typo3/sysext/backend/Classes/Form/DataPreprocessor.php
@@ -755,6 +755,8 @@ class DataPreprocessor {
 		// Foreign_table
 		$subres = BackendUtility::exec_foreign_table_where_query($fieldConfig, $field, $TSconfig);
 		while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres)) {
+			// Resolve move-placeholder, to check the right uid against $dataIds
+			BackendUtility::workspaceOL($fieldConfig['config']['foreign_table'], $subrow);
 			$recordList[$subrow['uid']] = BackendUtility::getRecordTitle($fieldConfig['config']['foreign_table'], $subrow);
 		}
 		$GLOBALS['TYPO3_DB']->sql_free_result($subres);
@@ -762,6 +764,8 @@ class DataPreprocessor {
 		if (is_array($GLOBALS['TCA'][$fieldConfig['config']['neg_foreign_table']])) {
 			$subres = BackendUtility::exec_foreign_table_where_query($fieldConfig, $field, $TSconfig, 'neg_');
 			while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($subres)) {
+				// Resolve move-placeholder, to check the right uid against $dataIds
+				BackendUtility::workspaceOL($fieldConfig['config']['nes_foreign_table'], $subrow);
 				$recordList[-$subrow['uid']] = BackendUtility::getRecordTitle($fieldConfig['config']['neg_foreign_table'], $subrow);
 			}
 			$GLOBALS['TYPO3_DB']->sql_free_result($subres);
-- 
GitLab