diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index fcbeeb897a8a9e358e03e065de9216f1bdd7ce68..2503d6bd59eb04ff195bda295ee0f946f50dfbe2 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -368,6 +368,24 @@ Signal::connect('model.updated', function($o, $d) { return isset($d['dirty']) && (isset($d['dirty']['name']) || isset($d['dirty']['type'])); }); +Filter::addSupportedMatches(/* trans */ 'Custom Forms', function() { + $matches = array(); + foreach (DynamicForm::objects()->filter(array('type'=>'G')) as $form) { + foreach ($form->getFields() as $f) { + if (!$f->hasData()) + continue; + $matches['field.'.$f->get('id')] = $form->getTitle().' / '.$f->getLabel(); + if (($fi = $f->getImpl()) instanceof SelectionField) { + foreach ($fi->getList()->getProperties() as $p) { + $matches['field.'.$f->get('id').'.'.$p->get('id')] + = $form->getTitle().' / '.$f->getLabel().' / '.$p->getLabel(); + } + } + } + } + return $matches; +}, 9900); + require_once(INCLUDE_DIR . "class.json.php"); class DynamicFormField extends VerySimpleModel { diff --git a/include/class.ticket.php b/include/class.ticket.php index d180fc26294c0bd45413c0ea4a3a80e7eebbd4ce..82b5527b06d35d66cd452d1cf76fda6f7546867c 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2299,6 +2299,16 @@ class Ticket { } } + if ($vars['topicId']) { + if (($__topic=Topic::lookup($vars['topicId'])) + && $__form = $__topic->getForm() + ) { + $__form = $__form->instanciate(); + $__form->setSource($vars); + $vars += $__form->getFilterData(); + } + } + //Init ticket filters... $ticket_filter = new TicketFilter($origin, $vars); // Make sure email contents should not be rejected