From 50980e2549f7022b2153285e2e383ba7ed776fd4 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 14 Jan 2014 14:05:34 -0600
Subject: [PATCH] Make priority field type NOT changeable

This is necessary because the system depends ticket priority to sort and
display ticket data.
---
 include/class.dynamic_forms.php | 5 ++++-
 include/class.forms.php         | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index e40e037f6..95d8712db 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -54,10 +54,13 @@ class DynamicForm extends VerySimpleModel {
     }
 
     function getDynamicFields() {
-        if (!isset($this->_dfields))
+        if (!isset($this->_dfields)) {
             $this->_dfields = DynamicFormField::objects()
                 ->filter(array('form_id'=>$this->id))
                 ->all();
+            foreach ($this->_dfields as $f)
+                $f->setForm($this);
+        }
         return $this->_dfields;
     }
 
diff --git a/include/class.forms.php b/include/class.forms.php
index 6e6537bf0..71a27a087 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -798,6 +798,10 @@ class PriorityField extends ChoiceField {
     function hasIdValue() {
         return true;
     }
+    function isChangeable() {
+        return $this->getForm()->get('type') != 'T' ||
+            $this->get('name') != 'priority';
+    }
 
     function getChoices() {
         global $cfg;
-- 
GitLab