From 19f771e1063983c36e2f72471a5d6a56f77345d8 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 25 Aug 2014 22:14:13 -0500
Subject: [PATCH] forms: Restore saving of ID value for selection fields

---
 include/class.dynamic_forms.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 74b6ef4f3..e33d6e207 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -983,10 +983,15 @@ class SelectionField extends FormField {
     }
 
     function to_database($value) {
+        $id = null;
+        if (is_array($value)) {
+            reset($value);
+            $id = key($value);
+        }
         if ($value && is_array($value))
             $value = JsonDataEncoder::encode($value);
 
-        return $value;
+        return array($value, $id);
     }
 
     function to_php($value, $id=false) {
-- 
GitLab