From 0a7f35b69e9cd32f86563d9286cf39bb2f1ea626 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 16 Dec 2014 13:04:36 -0600
Subject: [PATCH] forms: Properly display staff/user field requirement

---
 include/class.dynamic_forms.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 8da97a335..173b09058 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -429,11 +429,18 @@ class DynamicFormField extends VerySimpleModel {
     }
 
     function getField($cache=true) {
+        global $thisstaff;
+
         if (!$cache)
             return new FormField($this->ht);
 
+        // Finagle the `required` flag for the FormField instance
+        $ht = $this->ht;
+        $ht['required'] = ($thisstaff) ? $this->isRequiredForStaff()
+            : $this->isRequiredForUsers();
+
         if (!isset($this->_field))
-            $this->_field = new FormField($this->ht);
+            $this->_field = new FormField($ht);
         return $this->_field;
     }
 
-- 
GitLab