Project

General

Profile

Actions

Bug #17073

closed

Marker ###REC_FIELD_[fieldname]### in TCA config of select type does not work with groups

Added by Nyffenegger David about 17 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2007-03-03
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

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)

Actions #1

Updated by Stefan Froemken over 13 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>

Actions #2

Updated by Noel Bossart over 13 years ago

Is this on someones radar?

Actions #3

Updated by Stefan Froemken over 13 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.

Actions #4

Updated by Franz Koch about 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).

Actions #5

Updated by Thorsten Kahler over 12 years ago

  • Category set to FormEngine aka TCEforms
  • Status changed from New to Accepted
  • Target version deleted (0)
  • Complexity set to hard
Actions #6

Updated by Alexander Opitz over 9 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)?

Actions #7

Updated by B. Kausch almost 9 years ago

Still existing, yes.

Actions #8

Updated by Alexander Opitz over 8 years ago

  • Status changed from Needs Feedback to New
Actions #9

Updated by Thomas Anders over 5 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.

Actions #10

Updated by Gerrit Code Review about 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

Actions #11

Updated by Gerrit Code Review about 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

Actions #12

Updated by Gerrit Code Review about 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

Actions #13

Updated by Gerrit Code Review about 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

Actions #14

Updated by Georg Ringer about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #15

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF