From 59ec7afc449857bb2c360b722755f5368f726042 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Mon, 23 Jul 2018 12:20:42 -0500
Subject: [PATCH] issue: ChoiceField Template Variable

This addresses an issue on the forums where osTicket does not add the proper
values to any custom choices field template variable. This adds an `asVar()`
function to `class ChoiceField` so we can return the proper values for the
template variables.
---
 include/class.forms.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/class.forms.php b/include/class.forms.php
index 582df3bf7..48a9e71c9 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -1621,6 +1621,11 @@ class ChoiceField extends FormField {
         return (string) $value;
     }
 
+    function asVar($value, $id=false) {
+        $value = $this->to_php($value);
+        return $this->toString($this->getChoice($value));
+    }
+
     function whatChanged($before, $after) {
         $B = (array) $before;
         $A = (array) $after;
-- 
GitLab