LP#1586567 Always return Fund Years sorted descending
authorRemington Steed <rjs7@calvin.edu>
Thu, 29 Sep 2016 18:55:41 +0000 (14:55 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 14 Mar 2017 20:31:25 +0000 (16:31 -0400)
Currently, fund year selectors in Acq interfaces (at least Acq Admin ->
Funds, and Acq -> Load MARC Order Records) show the fund years in
database order. This commit adds a descending sort to the perl function
that retrieves fund years for those interfaces. It also removes the
unsuccessful attempt at sorting that was present in the dojo code.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dawn Dale <ddale@georgialibraries.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
Open-ILS/web/js/ui/default/acq/financial/list_funds.js
Open-ILS/web/js/ui/default/acq/picklist/upload.js

index 28b4f51..e66e648 100644 (file)
@@ -327,8 +327,11 @@ sub retrieve_org_funds {
                 acqf => [{column => 'year', transform => 'distinct'}]
             }, 
             from => 'acqf', 
                 acqf => [{column => 'year', transform => 'distinct'}]
             }, 
             from => 'acqf', 
-            where => $filter}
-        );
+            where => $filter,
+            order_by => {
+                acqf => {"year" => {"direction" => "desc"}}
+            }
+        });
 
         return [map { $_->{year} } @$data];
     }
 
         return [map { $_->{year} } @$data];
     }
index 69ec8b4..0d2f7de 100644 (file)
@@ -169,7 +169,6 @@ function loadYearSelector() {
                 yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings
 
                 var yearStore = {identifier:'year', name:'year', items:yearList};
                 yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings
 
                 var yearStore = {identifier:'year', name:'year', items:yearList};
-                yearStore.items = yearStore.items.sort().reverse();
                 fundFilterYearSelect.store = new dojo.data.ItemFileWriteStore({data:yearStore});
 
                 // default to this year
                 fundFilterYearSelect.store = new dojo.data.ItemFileWriteStore({data:yearStore});
 
                 // default to this year
index 6abdc69..b2af53f 100644 (file)
@@ -224,7 +224,6 @@ function loadYearSelector() {
                 yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings
 
                 var yearStore = {identifier:'year', name:'year', items:yearList};
                 yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings
 
                 var yearStore = {identifier:'year', name:'year', items:yearList};
-                yearStore.items = yearStore.items.sort().reverse();
                 acqUploadYearSelector.store = new dojo.data.ItemFileReadStore({data:yearStore});
 
                 // until an ordering agency is selected, default to the 
                 acqUploadYearSelector.store = new dojo.data.ItemFileReadStore({data:yearStore});
 
                 // until an ordering agency is selected, default to the