Skip to content

Commit 418623f

Browse files
committed
You can now set an array of predefined values in a tform select field together with a datasource. The data of the "value" array and the datasource data get merged, so that the datasource data gets appended to the value array.
1 parent a471088 commit 418623f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,11 @@ function getHTML($record, $tab, $action = 'NEW') {
361361

362362
// If Datasource is set, get the data from there
363363
if(isset($field['datasource']) && is_array($field['datasource'])) {
364-
$field["value"] = $this->getDatasourceData($field, $record);
364+
if(is_array($field["value"])) {
365+
$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
366+
} else {
367+
$field["value"] = $this->getDatasourceData($field, $record);
368+
}
365369
}
366370

367371
// If a limitation for the values is set
@@ -470,7 +474,11 @@ function getHTML($record, $tab, $action = 'NEW') {
470474

471475
// If Datasource is set, get the data from there
472476
if(@is_array($field['datasource'])) {
473-
$field["value"] = $this->getDatasourceData($field, $record);
477+
if(is_array($field["value"])) {
478+
$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
479+
} else {
480+
$field["value"] = $this->getDatasourceData($field, $record);
481+
}
474482
}
475483

476484
// If a limitation for the values is set

0 commit comments

Comments
 (0)