From 470949cc55f090325b4e3d32658b4177415a6ad4 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 25 Aug 2014 22:23:48 -0500
Subject: [PATCH] forms: Disconnect toString() and getChoice() functionality

---
 include/class.forms.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/class.forms.php b/include/class.forms.php
index 58a8fe403..490ad8df5 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -786,7 +786,9 @@ class ChoiceField extends FormField {
     }
 
     function toString($value) {
-        return (string) $this->getChoice($value);
+        $selection = $this->getChoice($value);
+        return is_array($selection) ? implode(', ', array_filter($selection))
+            : (string) $selection;
     }
 
     function getChoice($value) {
@@ -800,7 +802,7 @@ class ChoiceField extends FormField {
         elseif ($this->get('default'))
             $selection[] = $choices[$this->get('default')];
 
-        return $selection ? implode(', ', array_filter($selection)) : '';
+        return $selection;
     }
 
     function getChoices($verbose=false) {
-- 
GitLab