From 1c4b071565cc7bbdcc813506fd3df016c375ad7c Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@enhancesoft.com>
Date: Mon, 19 Mar 2018 13:27:49 +0000
Subject: [PATCH] Advanced Search: Recent Searches

Retire the need to auto-load the criteria of the last search - it's no
longer necessary since Recent Searches are now supported.
---
 include/ajax.search.php | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/ajax.search.php b/include/ajax.search.php
index bd39a2e0e..cc6f1fbd6 100644
--- a/include/ajax.search.php
+++ b/include/ajax.search.php
@@ -35,14 +35,10 @@ class SearchAjaxAPI extends AjaxController {
         if ($search->parent_id) {
             $search->flags |= SavedSearch::FLAG_INHERIT_COLUMNS;
         }
-        if (isset($_SESSION[$context])) {
-            // Use the most recent search
-            if (!$key) {
-                reset($_SESSION[$context]);
-                $key = key($_SESSION[$context]);
-            }
+
+        if (isset($_SESSION[$context]) && $key && $_SESSION[$context][$key])
             $search->config = $_SESSION[$context][$key];
-        }
+
         $this->_tryAgain($search, $search->getForm());
     }
 
-- 
GitLab