diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 437b9c1248c98e08400a652e64cb29e9847e6d10..2da492069c3bd8aae2b02ca61afef2c9e2dee0e1 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -246,7 +246,7 @@ Filter::addSupportedMatches('User Data', function() { $matches['field.'.$f->get('id')] = 'User / '.$f->getLabel(); } return $matches; -}); +}, 20); class TicketForm extends DynamicForm { static $instance; @@ -330,7 +330,7 @@ Filter::addSupportedMatches('Ticket Data', function() { $matches['field.'.$f->get('id')] = 'Ticket / '.$f->getLabel(); } return $matches; -}); +}, 30); // Manage materialized view on custom data updates Signal::connect('model.created', array('TicketForm', 'updateDynamicDataView'), diff --git a/include/class.filter.php b/include/class.filter.php index 951832926e9a13150f6aa5d6387cafce06326b8f..50d32f6e3e530b6912956cb1b79aae2fddad0c7f 100644 --- a/include/class.filter.php +++ b/include/class.filter.php @@ -20,13 +20,17 @@ class Filter { static $match_types = array( 'User Information' => array( - 'name' => 'Name', - 'email' => 'Email', + array('name' => 'Name', + 'email' => 'Email', + ), + 900 ), 'Email Meta-Data' => array( - 'reply-to' => 'Reply-To Email', - 'reply-to-name' => 'Reply-To Name', - 'addressee' => 'Addressee (To and Cc)', + array('reply-to' => 'Reply-To Email', + 'reply-to-name' => 'Reply-To Name', + 'addressee' => 'Addressee (To and Cc)', + ), + 200 ), ); @@ -320,16 +324,16 @@ class Filter { } static function getSupportedMatches() { foreach (static::$match_types as $k=>&$v) { - if (is_callable($v)) - $v = $v(); + if (is_callable($v[0])) + $v[0] = $v[0](); } unset($v); - ksort(static::$match_types); - return static::$match_types; + uasort(static::$match_types, function($a, $b) { return $a[1] - $b[1]; }); + return array_map(function($a) { return $a[0]; }, static::$match_types); } - static function addSupportedMatches($group, $callable) { - static::$match_types[$group] = $callable; + static function addSupportedMatches($group, $callable, $order=10) { + static::$match_types[$group] = array($callable, $order); } static function getSupportedMatchFields() { diff --git a/include/class.organization.php b/include/class.organization.php index 69924a6c385e8e905039e6f3ae5dded74087d92a..a21c916bf16510126f59414c0d49e63582ffee34 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -396,6 +396,6 @@ Filter::addSupportedMatches('Organization Data', function() { $matches['field.'.$f->get('id')] = 'Organization / '.$f->getLabel(); } return $matches; -}); +},40); Organization::_inspect(); ?> diff --git a/include/class.topic.php b/include/class.topic.php index 18bda5a536b232f5b1f3ae71176df8f76046d466..8d4d460ab1dd915b3b53a047cc425e15541fb348 100644 --- a/include/class.topic.php +++ b/include/class.topic.php @@ -273,4 +273,4 @@ class Topic { } // Add fields from the standard ticket form to the ticket filterable fields -Filter::addSupportedMatches('Help Topic', array('topicId' => 'Topic ID')); +Filter::addSupportedMatches('Help Topic', array('topicId' => 'Topic ID'), 100);