Commit b6483a83 authored by Morton Jonuschat's avatar Morton Jonuschat Committed by Wouter Wolters
Browse files

[BUGFIX] Replace ###REC_FIELD with values from DB within FlexForms

Replace ###REC_FIELD_ in FlexForm context with values from database.
Within FlexForm context these values need to be found retrieved from
the key flexParentDatabaseRow.

Resolves: #72510
Releases: master, 7.6
Change-Id: I50dd915cf0fcc58e9943c94760033df38ee4f239
Reviewed-on: https://review.typo3.org/45597

Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Brinkert <christian.brinkert@googlemail.com>
Tested-by: default avatarChristian Brinkert <christian.brinkert@googlemail.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent 80b9c577
......@@ -970,7 +970,8 @@ abstract class AbstractItemProvider
// "field1###' AND ..." -> array("field1", "' AND ...")
$whereClauseSubParts = explode('###', $value, 2);
// @todo: Throw exception if there is no value? What happens for NEW records?
$rowFieldValue = $result['databaseRow'][$whereClauseSubParts[0]];
$databaseRowKey = empty($result['flexParentDatabaseRow']) ? 'databaseRow' : 'flexParentDatabaseRow';
$rowFieldValue = isset($result[$databaseRowKey][$whereClauseSubParts[0]]) ? $result[$databaseRowKey][$whereClauseSubParts[0]] : '';
if (is_array($rowFieldValue)) {
// If a select or group field is used here, it may have been processed already and
// is now an array. Use first selected value in this case.
......
......@@ -1281,6 +1281,22 @@ class TcaSelectItemsTest extends UnitTestCase
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.title=\'rowFieldValue\'',
[],
],
'replace REC_FIELD within FlexForm' => [
'AND fTable.title=###REC_FIELD_rowFieldFlexForm###',
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.title=\'rowFieldFlexFormValue\'',
[
'databaseRow' => [
'rowFieldThree' => [
0 => 'rowFieldThreeValue'
]
],
'flexParentDatabaseRow' => [
'rowFieldFlexForm' => [
0 => 'rowFieldFlexFormValue'
]
],
],
],
'replace REC_FIELD fullQuote' => [
'AND fTable.title=###REC_FIELD_rowField###',
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.title=\'rowFieldValue\'',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment