Project

General

Profile

Actions

Bug #92963

closed

FormEngine displays wrong field on symmetric side when type group is used for foreign_field/symmetric_field

Added by Tim Karliczek over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2020-12-01
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce the problem

  • Install EXT:styleguide
  • Inside styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric_mm.php change the TCA for the fields hotelid and branchid to type group:
        'hotelid' => [
            'label' => 'hotelid',
            'config' => [
                'type' => 'group',
                'internal_type' => 'db',
                'allowed' => 'tx_styleguide_inline_mnsymmetric',
                'minitems' => 1,
                'maxitems' => 1,
                'size' => 1,
            ]
        ],
        'branchid' => [
            'label' => 'branchid',
            'config' => [
                'type' => 'group',
                'internal_type' => 'db',
                'allowed' => 'tx_styleguide_inline_mnsymmetric',
                'minitems' => 1,
                'maxitems' => 1,
                'size' => 1,
            ]
        ],
  • Clear the TYPO3 cache
  • Create two records of table `tx_styleguide_inline_mnsymmetric` inside the TYPO3 backend
  • Edit the second record, click on "Create new" in field branches
  • A new IRRE shows up, inside the IRRE in the field branchid select the first created record
  • Save your changes

Actual results

  • In Record 1 and Record 2 inside the IRRE the field branchid is displayed

Expected results

  • In Record 1 (in this case it's the symmetric side) hotelid should be displayed
  • In Record 2 (in this case it's the foreign side) branchid should be displayed

Additional notes

  • Per default EXT:styleguide uses select fields inside styleguide/Configuration/TCA/tx_styleguide_inline_mnsymmetric_mm.php
  • This is working like expected, the bug occures only with type group

After some debugging i noticed, that the condition inside typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineIsOnSymmetricSide.php->addData() is not working for type group.

I tested with:
  • TYPO3 10.4.10, EXT:styleguide 10.0.4
  • TYPO3 current master, EXT:styleguide 11.0.1

Files

group_foreign-side.png (32.1 KB) group_foreign-side.png Tim Karliczek, 2020-12-01 07:31
group_symmetric-side.png (31.1 KB) group_symmetric-side.png Tim Karliczek, 2020-12-01 07:31
select_foreign-side.png (21.1 KB) select_foreign-side.png Tim Karliczek, 2020-12-01 07:31
select_symmetric-side.png (21.1 KB) select_symmetric-side.png Tim Karliczek, 2020-12-01 07:31
Actions #1

Updated by Tim Karliczek over 3 years ago

  • In typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineIsOnSymmetricSide.php->addData() the relevant array is different for type select and group
  • That is the reason why $result['isOnSymmetricSide'] is set to true when type select is used, buto to false when type group is used
// with type select
$result['databaseRow']['branchId'] = [
    0 => '21',
]

// with type group
$result['databaseRow']['branchId'] = [
  0 => [
    'table' => 'tx_styleguide_inline_mnsymmetric',
    'uid' => 21,
    'title' => 'Record 1',
    'row' => [
      'uid' => 21,
      'pid' => 1,
      'tstamp' => 1606804748,
      'crdate' => 1606804748,
      'cruser_id' => 1,
      'deleted' => 0,
      'hidden' => 0,
      'sorting' => 256,
      'sys_language_uid' => 0,
      'l10n_parent' => 0,
      'l10n_source' => 0,
      'l10n_state' => NULL,
      't3_origuid' => 0,
      'l10n_diffsource' => '{"input_1":"","branches":"","sys_language_uid":"","hidden":""}',
      't3ver_oid' => 0,
      't3ver_wsid' => 0,
      't3ver_state' => 0,
      't3ver_stage' => 0,
      'input_1' => 'Record 1',
      'branches' => 0,
    ],
  ],
]

I think the condition should be changed to match both cases.

Actions #2

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New 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/c/Packages/TYPO3.CMS/+/66955

Actions #3

Updated by Tim Karliczek over 3 years ago

I added a pull request for EXT:styleguide to demonstrate the usage of a symmetric field combined with type group: https://github.com/TYPO3/styleguide/pull/171

Actions #4

Updated by Gerrit Code Review over 3 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/c/Packages/TYPO3.CMS/+/66955

Actions #5

Updated by Gerrit Code Review over 2 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/c/Packages/TYPO3.CMS/+/66955

Actions #6

Updated by Tim Karliczek over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF