Bug #17224
closedMapping problem in content element selectboxes
0%
Description
There is a problem with the mapping, when integrating external tables via the DBAL and showing a field with a selectbox.
In my case, i want to have an album with categories. These categories come from an second external table, that is mapped via DBAL too.
The first task is to display both albums and categories in an backend sysfolder. That works fine in both configuration, with variable mapping to a tablefield called 'page_id' and fixed mapping to a value. In both options the Listview shows the correct amount of albums and categories in the backend.
Second task is to be able to change the category of an album. Therefor i have configured the field in the tca.php to be a 'select' with foreign table pre_categories. Now it turns out, that there is something wrong in the mapping, because everytime i get a db failure and in the selectbox you can read [ Current value not allowed (3) ] even though the category is displayed in the Listview.
===== Example Configuration =====
$confArr['sysfolderID'] = 24;
$confArr['Prefix'] = 'non_';
===== Mapping in localconf =====
'pre_albums' => array (
'mapTableName' => $confArr['Prefix'] . 'albums',
'mapFieldNames' => array(
'pid' => 'page_id',
'uid' => 'aid',
)
),
'pre_categories' => array (
'mapTableName' => $confArr['Prefix'] . 'categories',
'mapFieldNames' => array(
'pid' => $confArr['sysfolderID'],
'uid' => 'cid',
)
),
===== TCA Configuration =====
'category' => Array (
'exclude' => 0,
'label' => 'Album Category',
'config' => Array (
'type' => 'select',
'items' => Array (
Array ('[ no Category ]', 0),
),
'size' => 1,
'maxitems' => 1,
'foreign_table' => 'pre_categories',
'foreign_table_where' => '',
)
),
===== Database Failure =====
0 SELECT pre_categories.cid, pre_categories.name
FROM pre_categories, pages
WHERE
pages.uid = pre_categories.pid AND pages.deleted = 0 AND 1 = 1
1 Unknown column 'pre_categories.pid' in 'where clause'
(issue imported from #M5465)
Files
Updated by Sebastian Fischer over 17 years ago
The attached Patch should solve this and the following bug 0005481.
In the function map_sqlParts now the array field 'value' is mapped too. First it checkes whether there is a field called 'value' is present. Then it splits every value on '.'. The resulting array is then checked against the mapping. The results are then combined and written back in the 'value' array.
Hope i didnt missed any checking. Comments welcome.
Updated by Karsten Dambekalns over 17 years ago
Thanks for your report (and the email from beginning of April). I'll close this one in favour of 4581, as it's shorter and more general.
Updated by Sebastian Fischer over 17 years ago
Sorry to say, that i disagree with the reference to 4581.
4581 addresses a caching problem and the provided patch fixes a problem with sql_info.
My report and 5481 are related to a problem that the right side of a select state isnt mapped at all. please take a look at the attached patch. Its solving a completely problem.
If the 4581 is only a typo, please take the patch into the 5481 request, as it fixes the same problem.
Updated by Karsten Dambekalns over 17 years ago
Sorry to say, that i disagree with the reference to 4581.
I know. I mistyped, that's why I immediately corrected the 4581 to 5481. Have a look at the bug history.