From f10795096160da3ee77bb3228178d05005af5515 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Sun, 15 Nov 2015 22:28:07 -0600
Subject: [PATCH] queue: Fix inability to drop saved search criteria

---
 include/class.search.php | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/class.search.php b/include/class.search.php
index 3f55ccccf..3fc0fa921 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -784,18 +784,20 @@ class SavedSearch extends VerySimpleModel {
         });
 
         // Load state from current configuraiton
-        foreach ($this->getCriteria() as $I) {
-            list($path, $method, $value) = $I;
-            if (!($F = $form->getField("{$path}+search")))
-                continue;
-            $F->value = true;
+        if (!$source) {
+            foreach ($this->getCriteria() as $I) {
+                list($path, $method, $value) = $I;
+                if (!($F = $form->getField("{$path}+search")))
+                    continue;
+                $F->value = true;
 
-            if (!($F = $form->getField("{$path}+method")))
-                continue;
-            $F->value = $method;
+                if (!($F = $form->getField("{$path}+method")))
+                    continue;
+                $F->value = $method;
 
-            if ($value && ($F = $form->getField("{$path}+{$method}")))
-                $F->value = $value;
+                if ($value && ($F = $form->getField("{$path}+{$method}")))
+                    $F->value = $value;
+            }
         }
         return $form;
     }
-- 
GitLab