diff -urN typo3_src-4.2.1.orig/t3lib/class.t3lib_tcemain.php typo3_src-4.2.1/t3lib/class.t3lib_tcemain.php --- typo3_src-4.2.1.orig/t3lib/class.t3lib_tcemain.php 2008-06-11 10:14:58.000000000 +0200 +++ typo3_src-4.2.1/t3lib/class.t3lib_tcemain.php 2008-07-14 20:48:31.000000000 +0200 @@ -682,6 +682,12 @@ $old_pid_value = $pid_value; $pid_value=intval($negFlag*$this->substNEWwithIDs[$pid_value]); } else {$OK = 0;} // If not found in the substArray we must stop the process... + } elseif ($table==='pages' && $pid_value<0 && $this->BE_USER->workspace!==0) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 't3ver_wsid='.$this->BE_USER->workspace.' and t3ver_move_id='.abs($pid_value)); + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + if ($row) { + $pid_value = -1*$row['uid']; + } } elseif ($pid_value>=0 && $this->BE_USER->workspace!==0 && $TCA[$table]['ctrl']['versioning_followPages']) { // PID points to page, the workspace is an offline space and the table follows page during versioning: This means we must check if the PID page has a version in the workspace with swapmode set to 0 (zero = page+content) and if so, change the pid to the uid of that version. if ($WSdestPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($this->BE_USER->workspace, 'pages', $pid_value, 'uid,t3ver_swapmode')) { // Looks for workspace version of page. if ($WSdestPage['t3ver_swapmode']==0) { // if swapmode is zero, then change pid value. @@ -2764,6 +2770,14 @@ $uid = intval($uid); $destPid = intval($destPid); + if ($this->BE_USER->workspace!==0 && $destPid < 0) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 't3ver_wsid='.$this->BE_USER->workspace.' and t3ver_move_id='.abs($destPid)); + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + if ($row) { + $destPid = -1*$row['uid']; + } + } + // Finding list of tables to copy. $copyTablesArray = $this->admin ? $this->compileAdminTables() : explode(',',$this->BE_USER->groupData['tables_modify']); // These are the tables, the user may modify if (!strstr($this->copyWhichTables,'*')) { // If not all tables are allowed then make a list of allowed tables: That is the tables that figure in both allowed tables AND the copyTable-list @@ -3316,6 +3330,14 @@ // Initialize: $destPid = intval($destPid); + if ($table === 'pages' && $this->BE_USER->workspace!==0 && $destPid < 0) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, 't3ver_wsid='.$this->BE_USER->workspace.' and t3ver_move_id='.abs($destPid)); + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); + if ($row) { + $destPid = -1*$row['uid']; + } + } + $propArr = $this->getRecordProperties($table,$uid); // Get this before we change the pid (for logging) $moveRec = $this->getRecordProperties($table,$uid,TRUE); $resolvedPid = $this->resolvePid($table,$destPid); // This is the actual pid of the moving to destination