Project

General

Profile

Actions

Bug #80699

closed

Story #69617: FormEngine bugs

Inline elements with foreign TCA relation to another table should load relations before saving record

Added by Thomas Hohn about 7 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2017-04-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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

Before-saving-record.png (111 KB) Before-saving-record.png Before saving record Thomas Hohn, 2017-04-05 18:48
After-saving-record-expected-behaviour.png (109 KB) After-saving-record-expected-behaviour.png After save/Expected behaviour Thomas Hohn, 2017-04-05 18:48
Actions #3

Updated by Thomas Hohn about 7 years ago

  • Description updated (diff)
Actions #4

Updated by Thomas Hohn about 7 years ago

  • Description updated (diff)
Actions #5

Updated by Thomas Hohn about 7 years ago

  • Description updated (diff)
Actions #6

Updated by Oliver Hader about 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

Actions #7

Updated by Oliver Hader about 7 years ago

  • Target version deleted (Candidate for patchlevel)
Actions #8

Updated by Thomas Hohn about 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?

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

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

Actions #13

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

Actions #14

Updated by Thomas Hohn about 7 years ago

  • Description updated (diff)
Actions #15

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

Actions #16

Updated by Christian Kuhn almost 7 years ago

  • Parent task set to #69617
Actions #17

Updated by Susanne Moog about 6 years ago

  • Category set to FormEngine aka TCEforms
Actions #18

Updated by Mona Muzaffar almost 6 years ago

  • Status changed from Under Review to Accepted
Actions #19

Updated by Susanne Moog about 4 years ago

  • Status changed from Accepted to Needs Feedback

See comments in the abandoned review, please provide a full example.

Actions #20

Updated by Christian Kuhn over 1 year ago

  • Status changed from Needs Feedback to Closed

Closing due to lack of further feedback.

Actions

Also available in: Atom PDF