Bug #80699
closedStory #69617: FormEngine bugs
Inline elements with foreign TCA relation to another table should load relations before saving record
0%
Description
We have a BackendPage with some in-line elements and in the inline elements there is foreign TCA relation to another table.
When we create a new element (before saving it) we would like to be able to display the existing relations - but the
###REC_FIELD_questions_uid### of the new inline-element is empty making it impossible to use AND questions_uid=###REC_FIELD_questions_uid###
in the foreign_table_where.
This used to be the case in previous versions of TYPO3.
The problem seems to be in the processing of ###REC_FIELD_field_name### where an extra condition could be added in case that the
###REC_FIELD_field_name### matches the [inlineParentConfig][foreign_field] it could be assigned the value from $result['inlineParentUid']
which is present at that time.
Use-case:
Matching of source and targets elements on a BE form.
User typically creates a number of targets on the form which are store in tx_systimequizmatching_targets.
Now the user want's to create relations between sources and targets by creating a source element in the
same form.
Before the patch the ###REC_FIELD_questions_uid### can't be resolved before the form has been saved - which makes it cumbersome
to create a lot of relations since it requires "create source element", "save" , "go to element again", "create relations" and
"save".
The prober way (used to be so in previous versions of TYPO3) was create source element, add relation and save (faster).
Involved tables:
Table tx_systimequizmatching_sources (sources) Table tx_systimequizmatching_targets (targets) Table tx_systimequizmatching_sources_targets_mm (MM table)
TCA for part of tx_systimequizmatching_sources is
'targets' => array( 'exclude' => 0, 'label' => 'LLL:EXT:systime_quiz_matching/Resources/Private/Language/locallang_db.xlf:tx_systimequizmatching_sources.targets', 'config' => array( 'type' => 'select', 'renderType' => 'selectCheckBox', 'disableNoMatchingValueElement' => 1, 'foreign_table' => 'tx_systimequizmatching_targets', 'foreign_table_where' => 'AND questions_uid=###REC_FIELD_questions_uid### AND questions_uid > 0 ORDER BY tx_systimequizmatching_targets.sorting', 'size' => 10, 'minitems' => 0, 'maxitems' => 10, 'MM' => 'tx_systimequizmatching_sources_targets_mm', 'renderMode' => 'checkbox', ) ),
Files
Updated by Thomas Hohn over 7 years ago
- File Before-saving-record.png Before-saving-record.png added
Updated by Thomas Hohn over 7 years ago
Updated by Oliver Hader over 7 years ago
- Status changed from New to Needs Feedback
How does your TCA settings look like for the field containing the ###REC_FIELD_...###
condition?
In general foreign_table_where
should not be allowed for TCA type inline, but for type select see https://docs.typo3.org/typo3cms/TCAReference/7.6/Reference/Columns/Select/#foreign-table-where
Updated by Oliver Hader over 7 years ago
- Target version deleted (
Candidate for patchlevel)
Updated by Thomas Hohn over 7 years ago
The TCA looks like:
.... 'targets' => array( 'exclude' => 0, 'label' => 'LLL:EXT:systime_quiz_matching/Resources/Private/Language/locallang_db.xlf:tx_systimequizmatching_sources.targets', 'config' => array( 'type' => 'select', 'renderType' => 'selectCheckBox', 'disableNoMatchingValueElement' => 1, 'foreign_table' => 'tx_systimequizmatching_targets', 'foreign_table_where' => 'AND questions_uid=###REC_FIELD_questions_uid### AND questions_uid > 0 ORDER BY tx_systimequizmatching_targets.sorting', 'size' => 10, 'minitems' => 0, 'maxitems' => 10, 'MM' => 'tx_systimequizmatching_sources_targets_mm', 'renderMode' => 'checkbox', ) ), ...
It works fine - except when the in-line element is created since the questions_uid is then empty. There seems to be a comment
// @todo: Throw exception if there is no value? What happens for NEW records?
in the source code - could do the fix - maybe it's then more clear what the problem is?
Updated by Gerrit Code Review over 7 years ago
- Status changed from Needs Feedback 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/52371
Updated by Gerrit Code Review over 7 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/52371
Updated by Gerrit Code Review over 7 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/52371
Updated by Gerrit Code Review over 7 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52371
Updated by Gerrit Code Review over 7 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52371
Updated by Gerrit Code Review over 7 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52371
Updated by Susanne Moog almost 7 years ago
- Category set to FormEngine aka TCEforms
Updated by Mona Muzaffar over 6 years ago
- Status changed from Under Review to Accepted
Updated by Susanne Moog over 4 years ago
- Status changed from Accepted to Needs Feedback
See comments in the abandoned review, please provide a full example.
Updated by Christian Kuhn almost 2 years ago
- Status changed from Needs Feedback to Closed
Closing due to lack of further feedback.