Bug #15170
closedSelector box which selects more than one file from file folder looses data on reload
0%
Description
If you configure a selector box to get its items from a folder and maxitems is greater than 1, the stored files are lost, when the form is reloaded.
example for field configuration:
$TCA["tx_testselect_test"] = Array (
"columns" => Array (
"test" => Array (
"exclude" => 1,
"label" => "test",
"config" => Array (
"type" => "select",
"fileFolder" => "fileadmin/",
"fileFolder_extList" => "",
"size" => 1,
"minitems" => 0,
"maxitems" => 5,
)
),
),
"types" => Array (
"0" => Array("showitem" => "hidden;;1;;1-1-1, test, test2")
),
);
With this example it is possible to select one ore more files, they are also stored in the database table, when you save the record. But when the record is reopened, the selection of the files is lost, no files are selected. The stored values are not interpreted.
I'm not sure sure, but I think the bug is found in t3lib_transferdata::renderRecord_selectProc()
If the data comes from an item array, some special methods or from a foreign table, then the code works. But data from a file folder is ignored:
[snip]
if (intval($fieldConfig['config']['maxitems'])>1) {
// Add regular elements:
if (is_array($fieldConfig['config']['items'])) {
$fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fieldConfig['config'], $TSconfig[$field], $table, $row, $field);
foreach($fieldConfig['config']['items'] as $pvpv) {
foreach($elements as $eKey => $value) {
if (!strcmp($value,$pvpv[1])) {
$dataAcc[$eKey]=rawurlencode($pvpv[1]).'|'.rawurlencode($pvpv[0]);
}
}
}
}
// Add "special"
if ($fieldConfig['config']['special']) {
$dataAcc = $this->selectAddSpecial($dataAcc, $elements, $fieldConfig['config']['special']);
}
// Add "foreign table" stuff:
if ($TCA[$fieldConfig['config']['foreign_table']]) {
$dataAcc = $this->selectAddForeign($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row);
}
// Always keep the native order for display in interface:
ksort($dataAcc);
}
[/snip]
(issue imported from #M1767)
Files