Commit 97a6103a authored by Steffen Müller's avatar Steffen Müller Committed by Christian Kuhn
Browse files

[BUGFIX] Replace ###CURRENT_PID### with value from DB within FlexForms

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

Resolves: #76888
Releases: master, 7.6
Change-Id: I5fd3cb0a18e41ae0d15cbb44556d05d88506a093
Reviewed-on: https://review.typo3.org/48749

Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarRalf Merz <info@merzilla.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarBamboo TYPO3com <info@typo3.com>
Reviewed-by: Sebastian Fischer's avatarSebastian Fischer <typo3@evoweb.de>
Tested-by: default avatarRalf Merz <info@merzilla.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 3c071aef
......@@ -962,6 +962,7 @@ abstract class AbstractItemProvider
{
$database = $this->getDatabaseConnection();
$localTable = $result['tableName'];
$effectivePid = $result['effectivePid'];
$foreignTableClause = '';
if (!empty($result['processedTca']['columns'][$localFieldName]['config']['foreign_table_where'])
......@@ -993,6 +994,12 @@ abstract class AbstractItemProvider
}
$foreignTableClause = implode('', $whereClauseParts);
}
// Use pid from parent page clause if in flex flom context
if (strpos($foreignTableClause, '###CURRENT_PID###') !== false
&& !empty($result['flexParentDatabaseRow']['pid'])
) {
$effectivePid = $result['flexParentDatabaseRow']['pid'];
}
$siteRootUid = 0;
foreach ($result['rootline'] as $rootlinePage) {
......@@ -1048,7 +1055,7 @@ abstract class AbstractItemProvider
'###PAGE_TSCONFIG_STR###'
],
[
(int)$result['effectivePid'],
(int)$effectivePid,
(int)$result['databaseRow']['uid'],
$siteRootUid,
$pageTsConfigId,
......
......@@ -1319,6 +1319,15 @@ class TcaSelectItemsTest extends UnitTestCase
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.uid=43',
[],
],
'replace CURRENT_PID within FlexForm' => [
'AND fTable.uid=###CURRENT_PID###',
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.uid=77',
[
'flexParentDatabaseRow' => [
'pid' => '77',
],
],
],
'replace CURRENT_PID integer cast' => [
'AND fTable.uid=###CURRENT_PID###',
'pages.uid=fTable.pid AND pages.deleted=0 AND 1=1 AND fTable.uid=431',
......
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