From d3ca26f48d2f12cd3cd033330019d77c961910d6 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 2 Sep 2014 15:11:07 -0500 Subject: [PATCH] oops: Fix changing of ticket priority --- include/class.dynamic_forms.php | 4 +++- include/class.forms.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index c5133c9d6..279f58a3d 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -946,9 +946,11 @@ class DynamicFormEntryAnswer extends VerySimpleModel { } function getSearchKeys() { - $val = $this->getField()->to_php($this->getValue()); + $val = $this->getValue(); if (is_array($val)) return array_keys($val); + elseif (is_object($val) && method_exists($val, 'getId')) + return [$val->getId()]; return [$val]; } diff --git a/include/class.forms.php b/include/class.forms.php index 040cd2554..540cf7740 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1105,6 +1105,10 @@ class PriorityField extends ChoiceField { } function to_php($value, $id=false) { + if (is_array($id)) { + reset($id); + $id = key($id); + } return Priority::lookup($id); } -- GitLab