Actions
Bug #83179
openEpic #86307: Extbase allows to fetch deleted/hidden records (respects ignoreEnableFields)
getSysLanguageStatement builder does not respect enable fields
Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2017-11-30
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
I stumbled upon a problem while listing translated rows from a custom table with config.sys_language_mode=strict
Steps to reproduce:- create a new repository, with [ctrl] transOrigPointerField, languageField and enablecolumns
- add some records to the repository in the default language
- add a new language
- create translated entries for the existing records
- hide/disable the second last translated entry
- list those entries in the frontend limited to count(*)-1 (so if you have created 5 records, limit it to 4)
- switch to the new language
- a findAll in the repository will return the first 4 records from the default language
- the language overlay will query each uid to check if there is a translated record available
- typo3 correctly excludes the one hidden record (the second last)
- the problem: the list does not show 4 items as requests and available, but only 3
the generated queries look something like this:
SELECT tx_test_domain_model_item.* FROM tx_test_domain_model_item
WHERE 1=1 AND
(tx_test_domain_model_item.sys_language_uid=-1 OR
(tx_test_domain_model_item.sys_language_uid = 2 AND tx_test_domain_model_item.l10n_parent=0) OR
(tx_test_domain_model_item.sys_language_uid=0 AND tx_test_domain_model_item.uid IN
(SELECT tx_test_domain_model_item.l10n_parent
FROM tx_test_domain_model_item
WHERE tx_test_domain_model_item.l10n_parent>0 AND
tx_test_domain_model_item.sys_language_uid=2 AND
tx_test_domain_model_item.deleted=0
)
)
) AND tx_test_domain_model_item.pid IN (37) AND tx_test_domain_model_item.deleted=0
AND tx_test_domain_model_item.hidden=0
ORDER BY tx_test_domain_model_item.sorting ASC
LIMIT 4;
-- followed by this for each found record:
SELECT * FROM tx_test_domain_model_item
WHERE pid=37 AND sys_language_uid=2 AND l10n_parent=1 AND
tx_test_domain_model_item.deleted=0 AND tx_test_domain_model_item.hidden=0
LIMIT 1
the problem goes down to:
Typo3DbQueryParser->getSysLanguageStatement
there the generator does only respected deleted fields in the subquery, but not hidden or outdated fields.
therefor this
// Add delete clause to ensure all entries are loaded
if (isset($GLOBALS['TCA'][$tableName]['ctrl']['delete'])) {
$additionalWhereClause .= ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['delete'] . '=0';
}
should be replaced by this:
// Add visibility constraints to ensure all entries are loaded and enabled
$enableFields = $this->getVisibilityConstraintStatement($querySettings, $tableName, $tableName);
if(!empty($enableFields)) {
$additionalWhereClause .= ' AND '. $enableFields;
}
Actions