[TYPO3-core] RFC: #8362: Duplicate entry for [tstamp] and [crdate] in Web->List module for single table in selector-box

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed May 21 11:25:07 CEST 2008


Steffen Kamper wrote: on 21.05.2008 10:39:

>>> Solution:
>>> only add tstamp and crdate if they are not in fields array.
>>>
>>> I'm not sure if there is a need to add tstamp and crdate if they are not 
>>> in fields. In this case these fields are not in the table?

>> recordList::makeFieldList() is the method that gets a list of fields. It 
>> adds those tstamp + crdate from TCA if you are an "admin" or if it is not 
>> checking for permissions.

> i don't see the check for admin there or any check,
> the comment says
> // Add pseudo "control" fields

See file typo3/class.db_list.inc function makeFieldList(), line 700:

	// Add special fields:
		if ($dontCheckUser || $BE_USER->isAdmin())      {
			$fieldListArr[]='uid';
			$fieldListArr[]='pid';
			if ($TCA[$table]['ctrl']['tstamp']) 
$fieldListArr[]=$TCA[$table]['ctrl']['tstamp'];
			if ($TCA[$table]['ctrl']['crdate']) 
$fieldListArr[]=$TCA[$table]['ctrl']['crdate'];
			...

This is the "right way" to add those two fields (as it takes their names 
from the TCA and also checks if they really exist), but you see that it 
is only called if user is "admin" or if the function is called with 
"dontCheckUser", which is not the case when populating the field list.

So the "Add pseudo "control" fields" part that add them again is a bit 
strange. I found out where it came from:

http://code.typo3.org/v4/changeset/1127

This was introduced in 4.0, I guess as a "hack" to get those fields
selectable by users. Maybe Stucki recalls and can help us out by joining 
this thread.

> So having fields duplicated in list looks obviously wrong and i don't see a 
> reason why not remove them with the simple patch, we loose nothing. The bug 
> was posted by an user and this may irretate users.

Yes, I wasn't arguing about the usefulness of the fix, but about the way 
it was solved. The behaviour of adding the fields is of course wrong, as 
those might even not be the correct field names as defined by a table's TCA.

So in my eyes we shouldn't fix the bug caused by a "hack" with another 
"hack", but fix the origin of the problem.

Attached is a diff with how I would solve it. What do you think?

Cheers,
Ernesto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-8362-baschny-fix.diff
Type: text/x-diff
Size: 2110 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080521/70f440a5/attachment.diff 


More information about the TYPO3-team-core mailing list