Repair invoice LI search order by
authorBill Erickson <berick@esilibrary.com>
Wed, 12 Sep 2012 19:18:50 +0000 (15:18 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 17 Oct 2012 14:37:59 +0000 (10:37 -0400)
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>
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)