Project

General

Profile

Actions

Bug #16394

closed

DisplayCond => VERSION:IS:false always returns true

Added by Zach Davis over 18 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Workspaces
Target version:
-
Start date:
2006-07-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Currently, displayCond uses the following check for seeing if we're working with a verision (draft) of a record:

case 'VERSION':
switch((string)$parts[1]) {
case 'IS':
if (strtolower($parts[2])=='true') {
$output = (intval($row['pid'])==-1) ? TRUE : FALSE;
} elseif (strtolower($parts[2])=='false') {
$output = !(intval($row['pid'])==-1) ? TRUE : FALSE;
}
break;
}
break;

The problem, as a debug of $row will demonstrate, is that with draft records $row['pid'] always equals the pid of the live version and not, as we would expect, -1. There is, however, $row['_ORIG_PID'] which does contain a value of -1 on draft records. I've changed the statement to check for this value and to not display (or display, depending on how the displayCond is set) if it -1:

case 'VERSION':
switch((string)$parts[1]) {
case 'IS':
if (strtolower($parts[2])'true') {
$output = (intval($row['pid'])==-1 or $row['_ORIG_pid']==-1) ? TRUE : FALSE;
} elseif (strtolower($parts[2])=='false') {
$output = !(intval($row['pid'])==-1 or $row['_ORIG_pid']==-1) ? TRUE : FALSE;
}
break;
}
break;

This simple change solves a lot of problems, especially when dealing with unique fields, which are not updated in workspaces. This change makes it possible to not display unique fields in a workspace, which is good -- then, you can use shadowColumnsForNewPlaceholders to shadow the unique field into the placeholder when a record is created in a workspace -- end result is that unique fields can be set on record creation, but can only be edited in a live workspace, which makes workspaces considerably more usable, IMO.

This change should be made at lines 5255 and 5257 of class.t3lib_tceforms.php.

Hope this helps!
-- Zach

(issue imported from #M3908)


Files

bug3908.diff (1.41 KB) bug3908.diff Administrator Admin, 2008-03-13 13:51
T3X_aoe_versiondisplayfix-0_0_0-z-200803131354.t3x (2.76 KB) T3X_aoe_versiondisplayfix-0_0_0-z-200803131354.t3x Administrator Admin, 2008-03-13 13:52
bug3908_v2.patch (1.54 KB) bug3908_v2.patch Administrator Admin, 2010-09-17 19:49
Actions #1

Updated by Daniel Poetzinger over 16 years ago

This do not solve the problem because:

you have to detect versions like that:
- user is in live workspace: then the pid 1 check is correct
user is in workspace: then everything the user does is creating a new version of course. But because of ws-overlay the pid-1 check fails.

This will do the job:

case 'VERSION':
switch((string)$parts1) {
case 'IS':
$_isNewRecord=(intval($row['uid'])>0) ? false: true;
//Detection of Version can be done be detecting workspace of the user
$_isUserInWorkspace=($GLOBALS['BE_USER']->workspace >0)? true: false;
if (intval($row['pid'])==-1 || intval($row['_ORIG_pid'])==-1) {
$_isRecordDetectedAsVersion=true;
}
else {
$_isRecordDetectedAsVersion=false;
}
//(new records in a workspace are not handled as versionrecord)
// if its no new version we detect versions like thie: if editor is in workspace: always true | if editor is in Live ws: true if pid ==-1
$isVersion=($_isUserInWorkspace || $_isRecordDetectedAsVersion) && !$_isNewRecord;

if (strtolower($parts[2])=='true')    {                            
$output = $isVersion;
} elseif (strtolower($parts[2])=='false') {
$output = !$isVersion;
}
break;
}
break;
Actions #2

Updated by Benni Mack about 14 years ago

committed v2 to trunk (rev. 8811)
committed v2 to TYPO3_4-4 (rev. 8812)
committed v2 to TYPO3_4-3 (rev. 8813)
committed v2 to TYPO3_4-2 (rev. 8814)

Actions #3

Updated by Michael Stucki almost 11 years ago

  • Category changed from Miscellaneous to Workspaces
Actions #4

Updated by Michael Stucki almost 11 years ago

  • Project changed from 624 to TYPO3 Core
  • Category changed from Workspaces to Workspaces
  • Target version deleted (0)
Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF