From 2113df0696f500bc8ad439e25a5eae0375c90c5d Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 16 Jun 2014 15:34:01 -0500
Subject: [PATCH] Add filterable list item props for users and orgs

---
 include/class.dynamic_forms.php | 11 ++++++++---
 include/class.organization.php  |  6 ++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 68557e4d8..45419c7ec 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -244,6 +244,12 @@ Filter::addSupportedMatches('User Data', function() {
         if (!$f->hasData())
             continue;
         $matches['field.'.$f->get('id')] = 'User / '.$f->getLabel();
+        if (($fi = $f->getImpl()) instanceof SelectionField) {
+            foreach ($fi->getList()->getProperties() as $p) {
+                $matches['field.'.$f->get('id').'.'.$p->get('id')]
+                    = 'User / '.$f->getLabel().' / '.$p->getLabel();
+            }
+        }
     }
     return $matches;
 }, 20);
@@ -328,9 +334,8 @@ Filter::addSupportedMatches('Ticket Data', function() {
         if (!$f->hasData())
             continue;
         $matches['field.'.$f->get('id')] = 'Ticket / '.$f->getLabel();
-        if (strpos($f->get('type'), 'list-') === 0) {
-            list(,$id) = explode('-', $f->get('type'));
-            foreach (DynamicList::lookup($id)->getProperties() as $p) {
+        if (($fi = $f->getImpl()) instanceof SelectionField) {
+            foreach ($fi->getList()->getProperties() as $p) {
                 $matches['field.'.$f->get('id').'.'.$p->get('id')]
                     = 'Ticket / '.$f->getLabel().' / '.$p->getLabel();
             }
diff --git a/include/class.organization.php b/include/class.organization.php
index 9c420e66c..d95088d50 100644
--- a/include/class.organization.php
+++ b/include/class.organization.php
@@ -426,6 +426,12 @@ Filter::addSupportedMatches('Organization Data', function() {
         if (!$f->hasData())
             continue;
         $matches['field.'.$f->get('id')] = 'Organization / '.$f->getLabel();
+        if (($fi = $f->getImpl()) instanceof SelectionField) {
+            foreach ($fi->getList()->getProperties() as $p) {
+                $matches['field.'.$f->get('id').'.'.$p->get('id')]
+                    = 'Organization / '.$f->getLabel().' / '.$p->getLabel();
+            }
+        }
     }
     return $matches;
 },40);
-- 
GitLab