[BUGFIX] No content in workspace preview when using select.selectFields
authorTolleiv Nietsch <info@tolleiv.de>
Thu, 14 Jul 2011 18:09:03 +0000 (20:09 +0200)
committerTolleiv Nietsch <info@tolleiv.de>
Tue, 13 Sep 2011 21:54:46 +0000 (23:54 +0200)
The TypoScript property select.selectFields does not consider workspaces
in the frontend rendering process.

Resolves: #17284
Releases: 4.6, 4.5, 4.4
Change-Id: Id9d1e7dcf56b5aeeec3070ff11416e82ec1bb978
Reviewed-on: http://review.typo3.org/2089
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
typo3/sysext/cms/tslib/class.tslib_content.php

index 5723048..ad35714 100644 (file)
@@ -7413,7 +7413,19 @@ class tslib_cObj {
                $queryParts = $this->getWhere($table, $conf, TRUE);
 
                        // Fields:
-               $queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*';
+               if ($conf['selectFields']) {
+                       $queryParts['SELECT'] = $conf['selectFields'];
+                               // add uid, pid and t3ver_state in order to allow
+                               // versioning for TCA-based table
+                       if (isset($GLOBALS['TCA'][$table])) {
+                               $queryParts['SELECT'] .= ',uid,pid';
+                               if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
+                                       $queryParts['SELECT'] .= ',t3ver_state';
+                               }
+                       }
+               } else {
+                       $queryParts['SELECT'] = '*';
+               }
 
                        // Setting LIMIT:
                if ($conf['max'] || $conf['begin']) {