Bug #16394
closedDisplayCond => VERSION:IS:false always returns true
0%
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