Fixed bug #8362: Duplicate entry for [tstamp] and [crdate] in Web->List module for...
authorErnesto Baschny <ernst@cron-it.de>
Mon, 2 Jun 2008 08:51:44 +0000 (08:51 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Mon, 2 Jun 2008 08:51:44 +0000 (08:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3746 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/class.db_list.inc
typo3/class.db_list_extra.inc

index 5fc0f8f..fb196b2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-06-02  Ernesto Baschny  <ernst@cron-it.de>
+
+       * Fixed bug #8362: Duplicate entry for [tstamp] and [crdate] in Web->List module for single table in selector-box (thanks to Steffen Kamper)
+
 2008-05-31  Oliver Hader  <oliver@typo3.org>
 
        * Fixed bug #8336: JavaScript error in TBE_EDITOR causes login expired dialog
index 08b2dad..aeb9362 100755 (executable)
@@ -677,9 +677,10 @@ class recordList extends t3lib_recordList {
         *
         * @param       string          Table name
         * @param       boolean         If set, users access to the field (non-exclude-fields) is NOT checked.
+        * @param       boolean         If set, also adds crdate and tstamp fields (note: they will also be added if user is admin or dontCheckUser is set)
         * @return      array           Array, where values are fieldnames to include in query
         */
-       function makeFieldList($table,$dontCheckUser=0) {
+       function makeFieldList($table,$dontCheckUser=0,$addDateFields=0)        {
                global $TCA,$BE_USER;
 
                        // Init fieldlist array:
@@ -701,8 +702,16 @@ class recordList extends t3lib_recordList {
                        if ($dontCheckUser || $BE_USER->isAdmin())      {
                                $fieldListArr[]='uid';
                                $fieldListArr[]='pid';
+                       }
+
+                               // Add date fields
+                       if ($dontCheckUser || $BE_USER->isAdmin() || $addDateFields)    {
                                if ($TCA[$table]['ctrl']['tstamp'])     $fieldListArr[]=$TCA[$table]['ctrl']['tstamp'];
                                if ($TCA[$table]['ctrl']['crdate'])     $fieldListArr[]=$TCA[$table]['ctrl']['crdate'];
+                       }
+
+                               // Add more special fields:
+                       if ($dontCheckUser || $BE_USER->isAdmin())      {
                                if ($TCA[$table]['ctrl']['cruser_id'])  $fieldListArr[]=$TCA[$table]['ctrl']['cruser_id'];
                                if ($TCA[$table]['ctrl']['sortby'])     $fieldListArr[]=$TCA[$table]['ctrl']['sortby'];
                                if ($TCA[$table]['ctrl']['versioningWS'])       {
index 48f384e..b773f39 100755 (executable)
@@ -1292,11 +1292,9 @@ class localRecordList extends recordList {
                $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
 
                        // Request fields from table:
-               $fields = $this->makeFieldList($table);
+               $fields = $this->makeFieldList($table, false, true);
 
                        // Add pseudo "control" fields
-               $fields[]='tstamp';
-               $fields[]='crdate';
                $fields[]='_PATH_';
                $fields[]='_REF_';
                $fields[]='_LOCALIZATION_';