[TYPO3-mvc] enableFields VS deleted
Franz Koch
typo3.RemoveForMessage at elements-net.de
Mon Sep 20 13:33:00 CEST 2010
Hey Felix,
> Am 19.09.10 18:08, schrieb Franz Koch:
>> This works fine, BUT now also deleted records show up in the list -
>> and that's wrong.
>
> this is an v4 issue in the first place.
for FE I totally agree with you - it's a v4 issue, but not in BE scope,
see below.
>> In my eyes "deleted" is not an enableField in terms of "is the object
>> allowed to be displayed in FE" and should always be respected, and/or
>> should have it's own querySetting to enable/disable it.
>
> I'm totally with you but extbase handles this like v4 core does. The
> enableFields are (only) recieved via
>
> $GLOBALS['TSFE']->sys_page->enableFields($tableName)
>
> and the first field is 'deleted'. So this behaviour is not caused by
> extbase. Nevertheless we could think about coding around this for, as
> mentioned, I also think this behaviour is wrong.
Again, this is only true for FE - in BE it's a extbase issue, because in
BE enableFields differ from FE and deleted still is deleted. See
according section of the Typo3StorageBackend:
> /**
> * Adds additional WHERE statements according to the query settings.
> *
> * @param Tx_Extbase_Persistence_QuerySettingsInterface $querySettings The TYPO3 4.x specific query settings
> * @param string $tableName The table name to add the additional where clause for
> * @param string $sql
> * @return void
> */
> protected function addAdditionalWhereClause(Tx_Extbase_Persistence_QuerySettingsInterface $querySettings, $tableName, &$sql) {
> if ($querySettings instanceof Tx_Extbase_Persistence_Typo3QuerySettings) {
> if ($querySettings->getRespectEnableFields()) {
> $this->addEnableFieldsStatement($tableName, $sql);
> }
...
> }
> }
>
> /**
> * Builds the enable fields statement
> *
> * @param string $tableName The database table name
> * @param array &$sql The query parts
> * @return void
> */
> protected function addEnableFieldsStatement($tableName, array &$sql) {
> if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
> if (TYPO3_MODE === 'FE') {
> $statement = $GLOBALS['TSFE']->sys_page->enableFields($tableName);
> } else { // TYPO3_MODE === 'BE'
> $statement = t3lib_BEfunc::deleteClause($tableName);
> $statement .= t3lib_BEfunc::BEenableFields($tableName);
> }
> if(!empty($statement)) {
> $statement = substr($statement, 5);
> $sql['additionalWhereClause'][] = $statement;
> }
> }
> }
In method "addEnableFieldsStatement" you see, that additionally to the
enableFields also the deleteClause is added in BE context - but there
the deleteClause would have to stay preserved as they are NOT part of
the enableFields. So the deleteClause would have to move to it's own
if-condition in the "addAdditionalWhereClause" for the case of BE
requests - right?
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list