Bug #16476
closedTCAdefaults.table.field doesn't work for MM-fields
0%
Description
A new record can't have an mm-record, because it has no uid. So the default value for an mm-field is killed by class.t3lib_transferdata.php. There should be a check for new records to hand over the default value to t3lib_TCEforms.
(issue imported from #M4060)
Files
Updated by Oliver Hader almost 18 years ago
Please provide some more details. Which field do you want to override by TCAdefaults? MM-tables are not defined in TCA, so this might not work at all.
But, please just give an example. Thanks!
Updated by Marc Bastian Heinrichs almost 18 years ago
For example tt_news:
You cann't set a default category by TS with
TCAdefaults.tt_news.category = 2
because the relation to tt_news_cat is an mm-relation and the proceeding in t3lib_loaddbgroup.php or class.t3lib_transferdata.php kill the default value cause there is no uid for an new tt_news-record yet .
With fix in 4022 it works correct.
Updated by Oliver Hader almost 18 years ago
Ah thanks, now I got it. It could also be possible, that a list of UIDs will be defined (e.g. "2,5,1"). The readList in extracts these values and holds them for later writing with writeMM. It could also happen that different tables are affected, like "tt_news:2,tt_content:13,..."
I'll take a closer look at t3lib_loadDBgroup.
Updated by Marc Bastian Heinrichs almost 18 years ago
Thanks.
I had a look on it and I think the check dropping the default value was in class.t3lib_transferdata.php, but it's some time ago.
Updated by Bernhard Kraft almost 17 years ago
The attached patch fixes this problem ...
Has to get applied against 4.1.2 ... do not know if it works well for other versions.
greets,
Bernhard
Updated by Jeff Segars almost 17 years ago
Thanks Bernhard!
Seems to work for me on trunk but I haven't tested extensively enough to see if there are any side effects yet. I'm attaching an updated patch that applies cleanly to trunk. No functional changes from the original though.