From abcf0d609f566e28bb4db282ab3869fe43a7f73c Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 3 Mar 2015 14:47:31 -0600
Subject: [PATCH] forms: Retire the `private`, `required`, and `edit_mask`
 fields

These fields have been consolidated into the `flags` column.
---
 include/class.dynamic_forms.php | 5 ++++-
 include/class.forms.php         | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 8bb94d81c..7b610318a 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -874,12 +874,15 @@ class DynamicFormField extends VerySimpleModel {
         if (!$this->get('label'))
             $this->addError(
                 __("Label is required for custom form fields"), "label");
-        if ($this->get('required') && !$this->get('name'))
+        if (($this->isRequiredForStaff() || $this->isRequiredForUsers())
+            && !$this->get('name')
+        ) {
             $this->addError(
                 __("Variable name is required for required fields"
                 /* `required` is a visibility setting fields */
                 /* `variable` is used for automation. Internally it's called `name` */
                 ), "name");
+        }
         if (preg_match('/[.{}\'"`; ]/u', $this->get('name')))
             $this->addError(__(
                 'Invalid character in variable name. Please use letters and numbers only.'
diff --git a/include/class.forms.php b/include/class.forms.php
index 73e89287b..9f4ece823 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -498,7 +498,7 @@ class FormField {
      */
 
     function isEditable() {
-        return (($this->get('edit_mask') & 32) == 0);
+        return (($this->get('flags') & DynamicFormField::FLAG_MASK_EDIT) == 0);
     }
 
     /**
-- 
GitLab