Index: trunk/grails-app/controllers/InventoryItemDetailedController.groovy
===================================================================
--- trunk/grails-app/controllers/InventoryItemDetailedController.groovy	(revision 554)
+++ trunk/grails-app/controllers/InventoryItemDetailedController.groovy	(revision 562)
@@ -134,7 +134,21 @@
         def isFilterApplied = FilterUtils.isFilterApplied(params)
 
+        // Restore default sort if a new text search is requested
+        if(params.newTextSearch) {
+            params.sort = 'id'
+            params.order = 'desc'
+        }
+
         // Restore search unless a new search is being requested.
-        if(!params.quickSearch && !filterParams) {
-            if(session.inventoryItemQuickSearch) {
+        if(!params.searchText && !params.quickSearch && !filterParams) {
+            if(session.inventoryItemSearchText) {
+                params.searchText = session.inventoryItemSearchText
+                params.searchName = session.inventoryItemSearchName
+                params.searchDescription = session.inventoryItemSearchDescription
+                params.searchComment = session.inventoryItemSearchComment
+                params.searchLocation = session.inventoryItemSearchLocation
+                params.searchSpareFor = session.inventoryItemSearchSpareFor
+            }
+            else if(session.inventoryItemQuickSearch) {
                 params.quickSearch = session.inventoryItemQuickSearch
                 if(session.inventoryItemQuickSearchDaysBack)
@@ -166,9 +180,36 @@
             session.inventoryItemSearchFilterParams = new LinkedHashMap(filterParams)
             session.inventoryItemSearchFilter = new LinkedHashMap(params.filter)
+            // Clear any previous search.
+            session.removeAttribute("inventoryItemSearchText")
+            session.removeAttribute("inventoryItemSearchName")
+            session.removeAttribute("inventoryItemSearchDescription")
+            session.removeAttribute("inventoryItemSearchComment")
+            session.removeAttribute("inventoryItemSearchLocation")
+            session.removeAttribute("inventoryItemSearchSpareFor")
             session.removeAttribute("inventoryItemQuickSearch")
             session.removeAttribute("inventoryItemQuickSearchDaysBack")
         }
+        else if(params.searchText) {
+            // Quick Search Text:
+            def result = inventoryItemSearchService.getTextSearch(params, RCU.getLocale(request))
+            inventoryItemInstanceList = result.inventoryItemList
+            inventoryItemInstanceTotal = result.inventoryItemList.totalCount
+            params.message = result.message
+            filterParams.searchText = result.searchText
+            // Remember search.
+            session.inventoryItemSearchText = params.searchText
+            session.inventoryItemSearchName = params.searchName
+            session.inventoryItemSearchDescription = params.searchDescription
+            session.inventoryItemSearchComment = params.searchComment
+            session.inventoryItemSearchLocation = params.searchLocation
+            session.inventoryItemSearchSpareFor = params.searchSpareFor
+            // Clear any previous search.
+            session.removeAttribute("inventoryItemQuickSearch")
+            session.removeAttribute("inventoryItemQuickSearchDaysBack")
+            session.removeAttribute("inventoryItemSearchFilterParams")
+            session.removeAttribute("inventoryItemSearchFilter")
+        }
         else {
-            // Quick Search:
+            // Quick Search Links:
             if(!params.quickSearch) params.quickSearch = "all"
             def result = inventoryItemSearchService.getQuickSearch(params, RCU.getLocale(request))
@@ -178,9 +219,16 @@
             filterParams.quickSearch = result.quickSearch
             // Remember search.
-            session.removeAttribute("inventoryItemSearchFilterParams")
-            session.removeAttribute("inventoryItemSearchFilter")
             session.inventoryItemQuickSearch = result.quickSearch
             if(result.daysBack)
                 session.inventoryItemQuickSearchDaysBack = result.daysBack
+            // Clear any previous search.
+            session.removeAttribute("inventoryItemSearchText")
+            session.removeAttribute("inventoryItemSearchName")
+            session.removeAttribute("inventoryItemSearchDescription")
+            session.removeAttribute("inventoryItemSearchComment")
+            session.removeAttribute("inventoryItemSearchLocation")
+            session.removeAttribute("inventoryItemSearchSpareFor")
+            session.removeAttribute("inventoryItemSearchFilterParams")
+            session.removeAttribute("inventoryItemSearchFilter")
         }
 
