Commit 30b50f3b authored by Benni Mack's avatar Benni Mack Committed by Oliver Hader
Browse files

[!!!][TASK] Use move placeholders as default in workspaces

Only allow workspaces version 2 (TCA->ctrl->versioningWS)
and use this option as default when setting versioningWS to TRUE.

Releases: master
Resolves: #24449
Change-Id: I5cfa5aa4c11fa7ef38b45b42082da6e0d75eb4ed
Reviewed-on: https://review.typo3.org/35685


Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
parent bd5c9ef6
......@@ -4376,7 +4376,7 @@ class BackendUtility
// If version was found, swap the default record with that one.
if (is_array($wsAlt)) {
// Check if this is in move-state:
if ($previewMovePlaceholders && !$movePldSwap && ($table == 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && $unsetMovePointers) {
if ($previewMovePlaceholders && !$movePldSwap && $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $unsetMovePointers) {
// Only for WS ver 2... (moving)
// If t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($wsAlt['t3ver_state'])) {
......@@ -4428,8 +4428,7 @@ class BackendUtility
*/
public static function movePlhOL($table, &$row)
{
// Only for WS ver 2... (moving)
if ($table == 'pages' || (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
// If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
$moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
......@@ -4563,13 +4562,10 @@ class BackendUtility
$output = array();
foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
if ($tableName != 'pages' && $cfg['ctrl']['versioningWS']) {
$joinStatement = 'A.t3ver_oid=B.uid';
// Consider records that are moved to a different page
if (self::isTableMovePlaceholderAware($tableName)) {
$movePointer = new VersionState(VersionState::MOVE_POINTER);
$joinStatement = '(A.t3ver_oid=B.uid AND A.t3ver_state<>' . $movePointer
. ' OR A.t3ver_oid=B.t3ver_move_id AND A.t3ver_state=' . $movePointer . ')';
}
$movePointer = new VersionState(VersionState::MOVE_POINTER);
$joinStatement = '(A.t3ver_oid=B.uid AND A.t3ver_state<>' . $movePointer
. ' OR A.t3ver_oid=B.t3ver_move_id AND A.t3ver_state=' . $movePointer . ')';
// Select all records from this table in the database from the workspace
// This joins the online version with the offline version as tables A and B
$output[$tableName] = static::getDatabaseConnection()->exec_SELECTgetRows(
......@@ -4625,7 +4621,7 @@ class BackendUtility
if ($workspace === null) {
$workspace = static::getBackendUserAuthentication()->workspace;
}
if ((int)$workspace !== 0 && $GLOBALS['TCA'][$table] && (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
if ((int)$workspace !== 0 && $GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
// Select workspace version of record:
$row = static::getDatabaseConnection()->exec_SELECTgetSingleRow(
$fields,
......@@ -4781,13 +4777,15 @@ class BackendUtility
/**
* Determines whether a table is aware of using move placeholders,
* which means 'versioningWS' is set to 2.
* As of TYPO3 CMS 7, move placeholders is used as default so the method is obsolete.
*
* @param string $table
* @return bool
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use isTableWorkspaceEnabled() directly
*/
public static function isTableMovePlaceholderAware($table)
{
return (self::isTableWorkspaceEnabled($table) && (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] === 2);
return self::isTableWorkspaceEnabled($table);
}
/**
......
......@@ -439,7 +439,7 @@ class BackendUtilityTest extends UnitTestCase
'presetFields' => array(),
'tca' => array(
'ctrl' => array(
'versioningWS' => '2'
'versioningWS' => true
)
),
'expectedFields' => 'uid,t3ver_id,t3ver_state,t3ver_wsid,t3ver_count'
......
......@@ -167,7 +167,7 @@ class PlainDataResolver
protected function processVersionMovePlaceholders(array $ids)
{
// Early return on insufficient data-set
if (empty($this->workspaceId) || !$this->isVersionMovePlaceholderAware() || empty($ids)) {
if (empty($this->workspaceId) || !$this->isWorkspaceEnabled() || empty($ids)) {
return $ids;
}
......@@ -289,14 +289,6 @@ class PlainDataResolver
return BackendUtility::isTableWorkspaceEnabled($this->tableName);
}
/**
* @return bool
*/
protected function isVersionMovePlaceholderAware()
{
return BackendUtility::isTableMovePlaceholderAware($this->tableName);
}
/**
* @return bool
*/
......
......@@ -6,7 +6,7 @@ return array(
'sortby' => 'sorting',
'title' => 'LLL:EXT:lang/locallang_tca.xlf:pages',
'type' => 'doktype',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
'delete' => 'deleted',
'crdate' => 'crdate',
......
......@@ -9,7 +9,7 @@ return array(
'cruser_id' => 'cruser_id',
'delete' => 'deleted',
'sortby' => 'sorting',
'versioningWS' => 2,
'versioningWS' => true,
'rootLevel' => -1,
'versioning_followPages' => true,
'origUid' => 't3_origuid',
......
......@@ -23,7 +23,7 @@ return array(
'transOrigDiffSourceField' => 'l10n_diffsource',
'rootLevel' => -1,
// records can and should be edited in workspaces
'shadowColumnsForNewPlaceholders' => 'tablenames,fieldname,uid_local,uid_foreign',
'shadowColumnsForMovePlaceholders' => 'tablenames,fieldname,uid_local,table_local,uid_foreign',
'enablecolumns' => array(
'disabled' => 'hidden'
),
......
=================================================================
Breaking: #24449 - Use move placeholders as default in workspaces
=================================================================
Description
===========
The ctrl section of each TCA table has the property "versioningWS" which might be set to "1" (enabled) or to "2"
which enables "move placeholders" functionality.
The "move placeholders" are now active by default, removing the possibility to have a "simple workspace" concept
which does not consider sorting records inside a workspace.
Impact
======
All checks in TYPO3 consider all TCA tables that have workspaces enabled ("versioningWS") to be
move-placeholder-aware. All TCA tables that only have non-moveable-records in workspace now need the DB
table field "t3ver_moveid" to be added.
All existing TCA configurations with "versioningWS" can now simply be set to TRUE instead of "2".
Affected Installations
======================
Any installation with third-party extensions that use workspace functionality but do not have move-placeholder-enabled records.
Migration
=========
Make all TCA tables "move-placeholders" aware by adding the necessary database fields.
\ No newline at end of file
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
'shadowColumnsForNewPlaceholders' => 'offers',
'shadowColumnsForMovePlaceholders' => 'offers',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_offer.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
'shadowColumnsForNewPlaceholders' => 'prices',
'shadowColumnsForMovePlaceholders' => 'prices',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_price.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
),
'interface' => array(
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'parentid,parenttable',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_offer.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'parentid,parenttable',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_price.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'parentid,parenttable',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
),
'interface' => array(
......
......@@ -14,7 +14,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel_offer_rel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'hotelid,offerid',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_offer.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
),
'interface' => array(
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_price.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'parentid',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
),
'interface' => array(
......
......@@ -14,7 +14,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_hotel_offer_rel.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
// @see http://forge.typo3.org/issues/29278 which solves it implicitly in the Core
// 'shadowColumnsForNewPlaceholders' => 'hotelid,offerid',
......
......@@ -15,7 +15,7 @@ return array(
'disabled' => 'hidden',
),
'iconfile' => 'EXT:irre_tutorial/Resources/Public/Icons/icon_tx_irretutorial_offer.gif',
'versioningWS' => 2,
'versioningWS' => true,
'origUid' => 't3_origuid',
),
'interface' => array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment