[TYPO3-core] RFC #4405: Bug: SQL errors with foreign_table_where and ###REC_FIELD_*### marker

Martin Kutschker masi-no at spam-typo3.org
Fri Jul 3 15:43:52 CEST 2009


Andreas Otto schrieb:
> This is an SVN patch request.
> 
> Type: Bugfix
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=4405
> 
> Branches: Trunk, 4.2, 4.1
> 
> Problem:
> An SQL error appears if you use a ###REC_FIELD_*### marker inside the
> foreign_table_where configuration.
> 
> Example TCA:
> $TCA['tx_faqs']['columns']['similar_faq']['config']['foreign_table_where'] =
> ' AND tx_faqs.deleted=0 AND tx_faqs.pid IN (103) AND
> tx_faqs.sys_language_uid=###REC_FIELD_sys_language_uid### ORDER BY
> tx_faqs.question ASC'
> 
> The example above would only list other records if they have the same
> sys_language_uid which keeps the list smaller if you have more than 2
> languages on your TYPO3 installation. The resulting SQL will issue an SQL
> error if you create a new record because the record has not been saved and
> therefore the marker ###REC_FIELD_sys_language_uid### is empty.
> 
> Se also
> http://typo3.org/documentation/document-library/core-documentation/doc_core_
> api/4.2.0/view/4/2/ for an explanation of foreign_table_where.
> 
> Solution:
> Set $TSconfig['_THIS_ROW'][$fTWHERE_subpart[0]] to 0 if it is empty.

Why 0? This would only make sense for numerical fields.

Perhaps it would be better to add a special where clause for new records.

Masi


More information about the TYPO3-team-core mailing list