Bug #34508
tt_news-categories aren't assigned correctly from importer-records anymore
| Status: | Resolved | Start date: | 2012-03-04 | ||
|---|---|---|---|---|---|
| Priority: | Should have | Due date: | |||
| Assignee: | Loek Hilgersom | % Done: | 50% |
||
| Category: | - | Spent time: | - | ||
| Target version: | - | ||||
| Votes: | 0 |
Description
Since version 2 the tt_news-categories aren't assigned correctly from the importer-records anymore.
$conf['default_category'] in function getmail() contains the number of the categories to be assigned instead of the category-ids themselves. $conf['category_id'] seems to hold the first category only, but is never processed.
There's no TSConfig to override the settings in my installation.
tt_news is the latest version (3.1.0).
Associated revisions
Resolved bug #34508 categories are now assigned correctly again from importer records
Also fixed table misspelling (tx_t3blog_post_cat should be tx_t3blog_cat)
Resolved bug #34508 categories are now assigned correctly again from importer records
Also fixed table misspelling (tx_t3blog_post_cat should be tx_t3blog_cat)
History
Updated by Jan Bartels about 1 year ago
- Assignee set to Loek Hilgersom
- % Done changed from 0 to 50
I've found the cause:
In tca.php you inherit the settings of the category-field of tt_news:
$TCA['tx_mail2news_importer']['columns']['default_category'] = $TCA['tt_news']['columns']['category']; $TCA['tx_mail2news_importer']['columns']['default_category']['label'] = 'LLL:EXT:mail2news/locallang_db.xml:tx_mail2news_importer.default_category'; $TCA['tx_mail2news_importer']['columns']['default_category']['config']['minitems'] = 0;
At first sight elegant solution. But wrong.
tca.php of tt_news looks like this:
'category' => Array (
...
'config' => Array (
'type' => 'select',
'form_type' => 'user',
'userFunc' => 'tx_ttnews_TCAform_selectTree->renderCategoryFields',
'treeView' => 1,
'foreign_table' => 'tt_news_cat',
'autoSizeMax' => 50,
'minitems' => $confArr['requireCategories'] ? 1 : 0,
'maxitems' => 500,
'MM' => 'tt_news_cat_mm',
)
),
As you can see, an MM-relation is defined. This doesnt't hold for the mail2news_importer-record, though!
Solution:
Add complete default_category-definition without the MM-relation to tca.php:
'default_category' => array (
'exclude' => 1,
# 'l10n_mode' => 'exclude', // the localizalion mode will be handled by the userfunction
'label' => 'LLL:EXT:mail2news/locallang_db.xml:tx_mail2news_importer.default_category',
'config' => Array (
'type' => 'select',
'form_type' => 'user',
'userFunc' => 'tx_ttnews_TCAform_selectTree->renderCategoryFields',
'treeView' => 1,
'foreign_table' => 'tt_news_cat',
'autoSizeMax' => 50,
'minitems' => 0,
'maxitems' => 500,
)
),
delete in tca.php:
$TCA['tx_mail2news_importer']['columns']['default_category'] = $TCA['tt_news']['columns']['category']; $TCA['tx_mail2news_importer']['columns']['default_category']['label'] = 'LLL:EXT:mail2news/locallang_db.xml:tx_mail2news_importer.default_category'; $TCA['tx_mail2news_importer']['columns']['default_category']['config']['minitems'] = 0;
Updated by Loek Hilgersom about 1 year ago
- Status changed from New to Accepted
Thank you for posting this bug, and for tracking it down, I didn't notice yet.
I will check it soon and fix it.
Updated by Loek Hilgersom 11 months ago
- Status changed from Accepted to Resolved
Good catch, problem was indeed the MM setting. It did not return the first category, but the amount of categories chosen. Not sure how this bug got in (I must have tested it at some point, long time ago). Fixed now by removing the MM setting from the TCA for the categories field (both tt_news and t3blog).