Repair invoice LI search order by
authorBill Erickson <berick@esilibrary.com>
Wed, 12 Sep 2012 19:18:50 +0000 (15:18 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 14 Dec 2012 18:32:10 +0000 (13:32 -0500)
Ensure that when a user chooses the sort-by-title option in the invoice
lineitem search UI, then de-selects the option, the sort returns to the
default lineitem ID sort.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/acq/invoice/view.js

index 6c306db..7ac42c9 100644 (file)
@@ -296,7 +296,14 @@ function performSearch(pageDir) {
     if (dojo.byId('acq-invoice-search-sort-title').checked) {
         uriManager.order_by = 
             [ {"class": "acqlia", "field":"attr_value", "transform":"first"} ];
-    }
+
+    } else {
+
+        // last used order_by is cached in the global resultManager config
+        // in this case, we want to fall back to the default order_by (li.id)
+        delete resultManager.result_types.lineitem.search_options.order_by;
+        delete uriManager.order_by;
+    }  
 
     resultsLoader.lastSearch = searchObject;
     resultManager.go(searchObject)