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

Also available in: Atom PDF