Project

General

Profile

Actions

Bug #87569

open

itemsProcFunc in TCA in combination with used table not working correct

Added by Martin Weymayer over 5 years ago. Updated about 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2019-01-29
Due date:
% Done:

0%

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

Description

Steps zu reproduce:
- make extension f.e. products where you add mm relation for categories
- also add mm relation for "similar products" which is connected to products table
- add itemsProcFunc for "similar products" like:

'config' => array(
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                #'multiple' => 1,
                'foreign_table' => 'tx_produktdatenbank_domain_model_produkte',
                'MM' => 'tx_produktdatenbank_produkte_produkte_mm',
                'foreign_table_where' => 'ORDER BY title ASC ',
                'itemsProcFunc' => 'tx_produktdatenbank_flexform->extendedItemAehnlicheprodukte',
                'size' => '20',
                'autosizemax' => '20',
                'maxitems' => '99',
                'minitems' => '0'
            ),

and in extendedItemAehnlicheprodukte function:

$table = 'tx_produktdatenbank_domain_model_categories';
        $where = '1=1 ' . BackendUtility::BEenableFields ($table) . BackendUtility::deleteClause ($table);
        $res = $GLOBALS ['TYPO3_DB']->exec_selectQuery ('*', $table, $where, '', 'categorie');
        if ($res) {
            while ($row = $GLOBALS ['TYPO3_DB']->sql_fetch_assoc ($res)) {
                $label = BackendUtility::getRecordTitle ($table, $row);
                $value = $row ['uid'];
                $config ['items'] [] = Array (
                        $label,
                        $value 
                );
            }
            $GLOBALS ['TYPO3_DB']->sql_free_result ($res);
        }
        return $config;

expected result:
categories are added to "available objects" and only selected items from database are added to "selected items". The itemFormElValue should look like:

[itemFormElValue] => Array
        (
            [0] => 1
            [1] => 3
        )

actual result:
categories are added to "available objects" and selected items from database are added to "selected items" AND the product with ID of number of selected items from database is also added to "selected items". f. example:
you have added to product ID 4 the product with id 1 and 3 to selected objects for "similar produtcs" and saved to database. in mm relation table everything is correct saved. but on opening product with id 4 again the "selected objecs" now also added product with ID 2 (because you have added 2 products for similar products).
the itemFormElValue look now like:

[itemFormElValue] => Array
        (
            [0] => 2
            [1] => 1
            [2] => 3
        )

This bug only occures if you have a table in itemsProcFunc that is used by objec itselfs. If I change table from tx_produktdatenbank_domain_model_categories to f.ex. fe_users this bug is not comming up.


Files

items.jpg (103 KB) items.jpg Martin Weymayer, 2019-01-29 09:36

Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #85142: Recent reordering of TCA select items processing makes it impossible to post-process foreign_table itemsClosed2018-06-02

Actions
Related to TYPO3 Core - Bug #89998: Problem in TCA with type select if MM relation is usedAcceptedGeorg Ringer2019-12-20

Actions
Actions

Also available in: Atom PDF