From 418623f35e20f38d5f530c680d045f6a2de50dda Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 12 Apr 2010 13:57:18 +0000
Subject: [PATCH] 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.

---
 interface/lib/classes/tform.inc.php | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 636914658..35ca44317 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -361,7 +361,11 @@ class tform {
 
                                         // If Datasource is set, get the data from there
                                         if(isset($field['datasource']) && is_array($field['datasource'])) {
-                                                $field["value"] = $this->getDatasourceData($field, $record);
+												if(is_array($field["value"])) {
+													$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+												} else {
+                                                	$field["value"] = $this->getDatasourceData($field, $record);
+												}
                                         }
 										
 										// If a limitation for the values is set
@@ -470,7 +474,11 @@ class tform {
 
                                 // If Datasource is set, get the data from there
                                 if(@is_array($field['datasource'])) {
-                                	$field["value"] = $this->getDatasourceData($field, $record);
+                                	if(is_array($field["value"])) {
+										$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+									} else {
+                                    	$field["value"] = $this->getDatasourceData($field, $record);
+									}
                                 }
 								
 								// If a limitation for the values is set
-- 
GitLab