From 759b004cdc6f2488dd0f191cd3c4f418bd0046c0 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 f9c5d2258..ae165e085 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1795,6 +1795,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