From f142b95b711e2255600ba08fdbbc54cd2b8b7ac9 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 13 Nov 2015 14:07:52 -0600
Subject: [PATCH] queues: Fix creating new tickets

---
 include/class.dynamic_forms.php | 11 ++++++++---
 include/class.forms.php         |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 728846716..174066f81 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -121,8 +121,9 @@ class DynamicForm extends VerySimpleModel {
         $fields = $this->getFields();
         $form = new SimpleForm($fields, $source, array(
             'title' => $this->getLocal('title'),
-            'instructions' => $this->getLocal('instructions'))
-        );
+            'instructions' => $this->getLocal('instructions'),
+            'id' => $this->getId(),
+        ));
         return $form;
     }
 
@@ -947,6 +948,9 @@ class DynamicFormEntry extends VerySimpleModel {
     function getId() {
         return $this->get('id');
     }
+    function getFormId() {
+        return $this->form_id;
+    }
 
     function getAnswers() {
         return $this->answers;
@@ -998,7 +1002,8 @@ class DynamicFormEntry extends VerySimpleModel {
             $source = $source ?: $this->getSource();
             $options += array(
                 'title' => $this->getTitle(),
-                'instructions' => $this->getInstructions()
+                'instructions' => $this->getInstructions(),
+                'id' => $this->form_id,
                 );
             $this->_form = new CustomForm($fields, $source, $options);
         }
diff --git a/include/class.forms.php b/include/class.forms.php
index 34c162a14..054302393 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -46,7 +46,7 @@ class Form {
         $this->_source = ($source) ? $source : $_POST;
     }
 
-    function getId() {
+    function getFormId() {
         return @$this->id ?: static::$id;
     }
     function setId($id) {
@@ -1096,7 +1096,7 @@ class FormField {
      */
     function getFormName() {
         $default = $this->get('name') ?: $this->get('id');
-        if ($this->_form && is_numeric($fid = $this->_form->getId()))
+        if ($this->_form && is_numeric($fid = $this->_form->getFormId()))
             return substr(md5(
                 session_id() . '-form-field-id-' . $fid . $default), -14);
         elseif (is_numeric($this->get('id')))
-- 
GitLab