From f7bf6143a2da3e594ff04b40dec0edc5654ef5f7 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 2 Mar 2015 14:02:21 -0600
Subject: [PATCH] oops: Fix crash handling API requests which specify topicID

---
 include/api.tickets.php | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/api.tickets.php b/include/api.tickets.php
index d70eda638..81211387a 100644
--- a/include/api.tickets.php
+++ b/include/api.tickets.php
@@ -20,9 +20,10 @@ class TicketApiController extends ApiController {
         # the names to the supported request structure
         if (isset($data['topicId'])
                 && ($topic = Topic::lookup($data['topicId']))
-                && ($form = $topic->getForm())) {
-            foreach ($form->getDynamicFields() as $field)
-                $supported[] = $field->get('name');
+                && ($forms = $topic->getForms())) {
+            foreach ($forms as $form)
+                foreach ($form->getDynamicFields() as $field)
+                    $supported[] = $field->get('name');
         }
 
         # Ticket form fields
-- 
GitLab