diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 4091e7bb016c5d0efc15b23630d0265440e08f2c..5a2ecec0b2ea62290152a9d755253cd00cf4f290 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -374,6 +374,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 311e098b5d5edcd8f36e08ccd456153f72cec270..4e4c56f696a275ffe3aedd4c627316a77d847bd1 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2433,6 +2433,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