Project

General

Profile

Actions

Bug #16459

closed

Bug in t3lib_loaddbgroup.php when using defVals while creating new records

Added by JoH almost 18 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2006-08-11
Due date:
% Done:

0%

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

Description

Today I ran into some problems while transferring defVals to a TCE_form
containing group fields with MM relations.
In the link the defVal had been created correctly and it was transferred to
alt_doc.php (tested this with a debug of GPvars) but it never appeared in
the corresponding selectbox of the form.

Digging a bit deeper into the code I found out that it is a bug in
t3lib_loaddbgroup.php
In line 126 there's a check if the field is MM or not.

if($MMtable) {
$this->readMM($MMtable,$MMuid);
} else {
$this->readList($itemlist);
}
As you can see for this check only $MMtable is used.
If you create a new record the value for $MMuid always is empty since there
is no existing MM relation yet. So $this->readMM returns an empty value.

Changing the lines to

if($MMtable && $MMuid) {
$this->readMM($MMtable,$MMuid);
} else {
$this->readList($itemlist);
}

did the trick, because the empty $MMuid will trigger $this->readList instead
that will transfer the defVal (which is available in $itemlist) to the
field.

Could anyone check if this change will cause some unwanted behaviour?
IMHO it should not since $this->readMM would return a result anyway only if
$MMuid is not empty. (Which is only the case when editing a record but not
when creating a new one).

Try to fill in a predefined defVal for a group field with MM relations via URL Parameter while calling a backendform.

(issue imported from #M4022)


Files

0004022.patch (1.53 KB) 0004022.patch Administrator Admin, 2007-02-13 02:20

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #16476: TCAdefaults.table.field doesn't work for MM-fieldsClosedOliver Hader2006-08-18

Actions
Actions

Also available in: Atom PDF