Bug #17073
closedMarker ###REC_FIELD_[fieldname]### in TCA config of select type does not work with groups
100%
Description
If you use the marker ###REC_FIELD_[fieldname]### in the "foreign_table_where" of the "config" part of a field, it doesn't work if the referenced fieldname is defined as type "group".
Within the t3lib_BEfunc::exec_foreign_table_where_query function, the marker is replaced with $TSconfig['_THIS_ROW'][fieldname] which does not contain only the database field value but some other information like the displayed text and the database name.
The marker replacement works perfectly, if the refered field is of type select, becaue the $TSconfig['_THIS_ROW'][fieldname] returns in this case the database value of this field.
(issue imported from #M5124)
Updated by Stefan Froemken almost 14 years ago
I have the same problem. When I use ###REC_FIELD_pages### in my foreign_table_where it returns this:
pages_22|Produkte
But in database I can find 22 only.
That's why I tried it with this workaround:
<foreign_table_where>AND tx_myext_category.pid = (SELECT pages FROM tt_content WHERE uid=###THIS_UID###)</foreign_table_where>
Updated by Stefan Froemken almost 14 years ago
I think it is very complicated to solve, because you can add recods of different tables in group fields. To differ them TYPO3 prepends the tablename. Maybe you can solve it with help of a mm-table:
id | parent_id | table | table_id
1 | 23 | pages | 22
I think it will be the best solution, but on the other side it could be a little bit oversized. Let's here some other opinions.
Updated by Franz Koch over 13 years ago
issue still present in 4.5.2.
and it can be solved, because the according method t3lib_becunc::exec_foreign_table_where_query knows the TCA configuration of the processed table/column, so it can detect when it's dealing with a group field. And tablenames only get prepended if you allow relations to more then one table, so that's also not a big issue.
Where I see the issue is that the raw result row passed around get's modified by Typo3 at some point (the raw ID value is replaced by a prepended value including the record label). Found that out in a short debugging session of mentioned method.
edit: sorry, it's not possible to check for the field type, because we don't know the name of the currently rendered table to check the according TCA :(
So either the according parameters have to be added to the method or TYPO3 must not modify the raw values from $TSconfig['_THIS_ROW'] (I wonder why it's done anyway, because it's also causing issues with IRRE having group fields as label - but that's a different story).
Updated by Thorsten Kahler almost 13 years ago
- Category set to FormEngine aka TCEforms
- Status changed from New to Accepted
- Target version deleted (
0) - Complexity set to hard
Updated by Alexander Opitz almost 10 years ago
- Status changed from Accepted to Needs Feedback
- Is Regression set to No
Hi,
as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (6.2.9)?
Updated by Alexander Opitz about 9 years ago
- Status changed from Needs Feedback to New
Updated by Thomas Anders almost 6 years ago
- TYPO3 Version changed from 4.0 to 9
- PHP Version changed from 5.0 to 7.2
2018, TYPO3 9.5 and the error still exists.¶
For the googling people that hope to find a solution here, here is a workaround:
If you try to use e.g. the pages field:
'foreign_table_where' => 'AND tx_myextension_domain_model_myobject.pid = ###REC_FIELD_pages###',
You can achieve the same functionality with a subquery:
'foreign_table_where' => 'AND tx_myextension_domain_model_myobject.pid = (SELECT pages FROM tt_content WHERE uid=###THIS_UID###)',
This fully works expected but(!) subqueries can drastically slow down your your installation.
If there is any other way, I think you should go it.
Updated by Gerrit Code Review over 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63595
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63595
Updated by Gerrit Code Review over 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63595
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63775
Updated by Georg Ringer over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 408f9bcce837cfe4c393e7efaca2a97048cd927e.