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
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;
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)
Updated by Michael Stucki almost 11 years ago
- Category changed from Miscellaneous to Workspaces
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)