--- original\t3lib\class.t3lib_page.php 2007-04-02 23:41:34.000000000 +0200 +++ working\t3lib\class.t3lib_page.php 2007-06-11 11:26:21.046875000 +0200 @@ -936,6 +936,11 @@ function enableFields($table,$show_hidden=-1,$ignore_array=array(),$noVersionPreview=FALSE) { global $TYPO3_CONF_VARS; + //searching for a table alias in $table. preg_replace because table alias can be writenn "table AS tableAlias" or "table tableAlias" + $tempTableArr = t3lib_div::trimExplode(' ', preg_replace('/ as /i', ' ', $table), 1); + $table = $tempTableArr[0]; + $tableAlias = isset($tempTableArr[1]) ? $tempTableArr[1] : $tempTableArr[0]; + if ($show_hidden==-1 && is_object($GLOBALS['TSFE'])) { // If show_hidden was not set from outside and if TSFE is an object, set it based on showHiddenPage and showHiddenRecords from TSFE $show_hidden = $table=='pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords; } @@ -947,31 +952,31 @@ // Delete field check: if ($ctrl['delete']) { - $query.=' AND '.$table.'.'.$ctrl['delete'].'=0'; + $query.=' AND '.$tableAlias.'.'.$ctrl['delete'].'=0'; } // Filter out new place-holder records in case we are NOT in a versioning preview (that means we are online!) if ($ctrl['versioningWS'] && !$this->versioningPreview) { - $query.=' AND '.$table.'.t3ver_state!=1'; // Shadow state for new items MUST be ignored! + $query.=' AND '.$tableAlias.'.t3ver_state!=1'; // Shadow state for new items MUST be ignored! } // Enable fields: if (is_array($ctrl['enablecolumns'])) { if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) { // In case of versioning-preview, enableFields are ignored (checked in versionOL()) if ($ctrl['enablecolumns']['disabled'] && !$show_hidden && !$ignore_array['disabled']) { - $field = $table.'.'.$ctrl['enablecolumns']['disabled']; + $field = $tableAlias.'.'.$ctrl['enablecolumns']['disabled']; $query.=' AND '.$field.'=0'; } if ($ctrl['enablecolumns']['starttime'] && !$ignore_array['starttime']) { - $field = $table.'.'.$ctrl['enablecolumns']['starttime']; + $field = $tableAlias.'.'.$ctrl['enablecolumns']['starttime']; $query.=' AND ('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')'; } if ($ctrl['enablecolumns']['endtime'] && !$ignore_array['endtime']) { - $field = $table.'.'.$ctrl['enablecolumns']['endtime']; + $field = $tableAlias.'.'.$ctrl['enablecolumns']['endtime']; $query.=' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')'; } if ($ctrl['enablecolumns']['fe_group'] && !$ignore_array['fe_group']) { - $field = $table.'.'.$ctrl['enablecolumns']['fe_group']; + $field = $tableAlias.'.'.$ctrl['enablecolumns']['fe_group']; $query.= $this->getMultipleGroupsWhereClause($field, $table); } @@ -980,6 +985,7 @@ if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'])) { $_params = array( 'table' => $table, + 'tableAlias' => $tableAlias, 'show_hidden' => $show_hidden, 'ignore_array' => $ignore_array, 'ctrl' => $ctrl