Skip to content
Snippets Groups Projects
Commit 72860964 authored by Peter Rotich's avatar Peter Rotich
Browse files

Make help topic form optional

parent 7faf3026
No related branches found
No related tags found
No related merge requests found
...@@ -18,15 +18,16 @@ class TicketApiController extends ApiController { ...@@ -18,15 +18,16 @@ class TicketApiController extends ApiController {
); );
# Fetch dynamic form field names for the given help topic and add # Fetch dynamic form field names for the given help topic and add
# the names to the supported request structure # the names to the supported request structure
if (isset($data['topicId'])) { if (isset($data['topicId'])
$topic=Topic::lookup($data['topicId']); && ($topic = Topic::lookup($data['topicId']))
$form=DynamicForm::lookup($topic->ht['form_id']); && ($form = $topic->getForm())) {
foreach ($form->getDynamicFields() as $field) foreach ($form->getDynamicFields() as $field)
$supported[] = $field->get('name'); $supported[] = $field->get('name');
} }
$form = TicketForm::lookup()->instanciate();
foreach ($form->getDynamicFields() as $field) if(($form = TicketForm::lookup()->instanciate()))
$supported[] = $field->get('name'); foreach ($form->getDynamicFields() as $field)
$supported[] = $field->get('name');
if(!strcasecmp($format, 'email')) { if(!strcasecmp($format, 'email')) {
$supported = array_merge($supported, array('header', 'mid', $supported = array_merge($supported, array('header', 'mid',
......
...@@ -21,6 +21,7 @@ class Topic { ...@@ -21,6 +21,7 @@ class Topic {
var $parent; var $parent;
var $page; var $page;
var $form;
function Topic($id) { function Topic($id) {
$this->id=0; $this->id=0;
...@@ -44,7 +45,7 @@ class Topic { ...@@ -44,7 +45,7 @@ class Topic {
$this->ht = db_fetch_array($res); $this->ht = db_fetch_array($res);
$this->id = $this->ht['topic_id']; $this->id = $this->ht['topic_id'];
$this->page = null; $this->page = $this->form = null;
return true; return true;
...@@ -108,6 +109,17 @@ class Topic { ...@@ -108,6 +109,17 @@ class Topic {
return $this->page; return $this->page;
} }
function getFormId() {
return $this->ht['form_id'];
}
function getForm() {
if(!$this->form && $this->getFormId())
$this->form = DynamicForm::lookup($this->getFormId());
return $this->form;
}
function autoRespond() { function autoRespond() {
return (!$this->ht['noautoresp']); return (!$this->ht['noautoresp']);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment