From 482f5cb7fd4642486f2007f21288da95e6012306 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 1 May 2014 12:30:24 -0500
Subject: [PATCH] filter: Add more context to selected field

---
 include/class.dynamic_forms.php | 4 ++--
 include/class.filter.php        | 3 ++-
 include/class.organization.php  | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 942efbaa4..437b9c124 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -243,7 +243,7 @@ Filter::addSupportedMatches('User Data', function() {
     foreach (UserForm::getInstance()->getFields() as $f) {
         if (!$f->hasData())
             continue;
-        $matches['field.'.$f->get('id')] = $f->getLabel();
+        $matches['field.'.$f->get('id')] = 'User / '.$f->getLabel();
     }
     return $matches;
 });
@@ -327,7 +327,7 @@ Filter::addSupportedMatches('Ticket Data', function() {
     foreach (TicketForm::getInstance()->getFields() as $f) {
         if (!$f->hasData())
             continue;
-        $matches['field.'.$f->get('id')] = $f->getLabel();
+        $matches['field.'.$f->get('id')] = 'Ticket / '.$f->getLabel();
     }
     return $matches;
 });
diff --git a/include/class.filter.php b/include/class.filter.php
index 4c36541e6..951832926 100644
--- a/include/class.filter.php
+++ b/include/class.filter.php
@@ -318,12 +318,13 @@ class Filter {
         if ($this->getHelpTopic())
             $ticket['topicId'] = $this->getHelpTopic();
     }
-    /* static */ function getSupportedMatches() {
+     static function getSupportedMatches() {
         foreach (static::$match_types as $k=>&$v) {
             if (is_callable($v))
                 $v = $v();
         }
         unset($v);
+        ksort(static::$match_types);
         return static::$match_types;
     }
 
diff --git a/include/class.organization.php b/include/class.organization.php
index d02450723..69924a6c3 100644
--- a/include/class.organization.php
+++ b/include/class.organization.php
@@ -393,7 +393,7 @@ Filter::addSupportedMatches('Organization Data', function() {
     foreach (OrganizationForm::getInstance()->getFields() as $f) {
         if (!$f->hasData())
             continue;
-        $matches['field.'.$f->get('id')] = $f->getLabel();
+        $matches['field.'.$f->get('id')] = 'Organization / '.$f->getLabel();
     }
     return $matches;
 });
-- 
GitLab