From 27430f9832009596d4566e7829c35ee038fe784d Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 15 Jul 2014 12:31:41 -0500
Subject: [PATCH] forms: Fix display of validation errors

When managing properties of list items
---
 include/class.dynamic_forms.php | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 7f62314d2..f56f65dd6 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -46,13 +46,18 @@ class DynamicForm extends VerySimpleModel {
     var $_dfields;
 
     function getFields($cache=true) {
-        if (!isset($this->_fields) || !$cache) {
-            $this->_fields = array();
+        if (!$cache)
+            $fields = false;
+        else
+            $fields = &$this->_fields;
+
+        if (!$fields) {
+            $fields = new ArrayObject();
             foreach ($this->getDynamicFields() as $f)
                 // TODO: Index by field name or id
-                $this->_fields[$f->get('id')] = $f->getImpl($f);
+                $fields[$f->get('id')] = $f->getImpl($f);
         }
-        return $this->_fields;
+        return $fields;
     }
 
     function getDynamicFields() {
-- 
GitLab