From c2b99dd9fbada3ce4b5d0adc367190086985b62a Mon Sep 17 00:00:00 2001 From: Daniel Siepmann <daniel.siepmann@typo3.org> Date: Thu, 16 Jan 2020 11:26:03 +0100 Subject: [PATCH] [BUGFIX] Prevent ambiguous column name for TCA items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When fetching items from foreign table, they might be sorted based on foreign table configured sorting. In such case the foreign table name is prefixed to prevent ambiguous column name. Resolves: #90127 Related: #70677 Releases: master, 9.5 Change-Id: Iebda2bd417481ae01b1265dd9be31b67af89991d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62929 Reviewed-by: Felix P. <f.pachowsky@neusta.de> Reviewed-by: Jörg Bösche <typo3@joergboesche.de> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com> Reviewed-by: Tobi Kretschmann <tobi@tobishome.de> Tested-by: Jörg Bösche <typo3@joergboesche.de> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com> Tested-by: Tobi Kretschmann <tobi@tobishome.de> --- .../Classes/Form/FormDataProvider/AbstractItemProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php index b2fedd14e0c4..44d41b15171d 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php @@ -1008,7 +1008,7 @@ abstract class AbstractItemProvider $orderByClauses = QueryHelper::parseOrderBy($GLOBALS['TCA'][$foreignTableName]['ctrl']['default_sortby']); foreach ($orderByClauses as $orderByClause) { if (!empty($orderByClause[0])) { - $queryBuilder->addOrderBy($orderByClause[0], $orderByClause[1]); + $queryBuilder->addOrderBy($foreignTableName . '.' . $orderByClause[0], $orderByClause[1]); } } } -- GitLab