From b74e02c3732488e48b47bf7b84f58496f4530e92 Mon Sep 17 00:00:00 2001
From: Fabian Galinski <fabian@sgalinski.de>
Date: Sun, 18 Jun 2017 22:06:15 +0200
Subject: [PATCH] [BUGFIX] The title generation isn't working within workspaces

---
 Classes/TCA/TcaProvider.php | 21 +++++++++++++++++++--
 composer.json               |  2 +-
 ext_emconf.php              |  2 +-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Classes/TCA/TcaProvider.php b/Classes/TCA/TcaProvider.php
index d1cbd65..d142e9e 100644
--- a/Classes/TCA/TcaProvider.php
+++ b/Classes/TCA/TcaProvider.php
@@ -72,15 +72,32 @@ class TcaProvider implements SingletonInterface {
 				$pagesIdentity = (int) $identity;
 				if ($table === 'pages_language_overlay') {
 					$translationRow = $database->exec_SELECTgetSingleRow(
-						'pid, subtitle', 'pages_language_overlay', 'uid = ' . (int) $identity
+						'pid, subtitle, t3ver_oid', 'pages_language_overlay', 'uid = ' . (int) $identity
 					);
+
+					$workspaceOriginalId = (int) $translationRow['t3ver_oid'];
+					if ($workspaceOriginalId > 0) {
+						$translationRow = $database->exec_SELECTgetSingleRow(
+							'pid, subtitle, t3ver_oid', 'pages_language_overlay', 'uid = ' . $workspaceOriginalId
+						);
+					}
+
 					$pagesIdentity = (int) $translationRow['pid'];
 				}
 
 				$row = $database->exec_SELECTgetSingleRow(
-					'doktype, subtitle, lastUpdated, tx_sgnews_highlighted', 'pages', 'uid = ' . $pagesIdentity
+					'doktype, subtitle, lastUpdated, tx_sgnews_highlighted, t3ver_oid', 'pages', 'uid = ' .
+						$pagesIdentity
 				);
 
+				$workspaceOriginalId = (int) $row['t3ver_oid'];
+				if ($workspaceOriginalId > 0) {
+					$row = $database->exec_SELECTgetSingleRow(
+						'doktype, subtitle, lastUpdated, tx_sgnews_highlighted, t3ver_oid', 'pages', 'uid = ' .
+						$workspaceOriginalId
+					);
+				}
+
 				// only articles
 				$row['doktype'] = (int) $row['doktype'];
 				if (!is_array($row) || !count($row) || !in_array($row['doktype'], [116])) {
diff --git a/composer.json b/composer.json
index a0eac7b..ad4e856 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
 	"license": [
 		"GPL-2.0+"
 	],
-	"version": "3.9.0",
+	"version": "3.9.1",
 	"support": {
 	},
 	"repositories": [
diff --git a/ext_emconf.php b/ext_emconf.php
index 6b82c76..7df4d45 100644
--- a/ext_emconf.php
+++ b/ext_emconf.php
@@ -19,7 +19,7 @@ $EM_CONF[$_EXTKEY] = [
 	'modify_tables' => '',
 	'clearCacheOnLoad' => 0,
 	'lockType' => '',
-	'version' => '3.9.0',
+	'version' => '3.9.1',
 	'constraints' => [
 		'depends' => [
 			'typo3' => '7.6.0-8.7.99',
-- 
GitLab