LP#1384868: limit fund drop-downs on the invoice page to only active funds user/gmcharlt/lp1384868_limit_fund_dropdowns_to_active
authorGalen Charlton <gmc@esilibrary.com>
Thu, 23 Oct 2014 19:17:58 +0000 (12:17 -0700)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 23 Oct 2014 19:50:21 +0000 (12:50 -0700)
This patch fixes the fund selectors for adding extra copies
and charges to invoices to only active funds (in addition
to the existing restriction to funds visible to the user).

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/web/js/ui/default/acq/invoice/view.js

index 3d42e43..d5cf6f1 100644 (file)
@@ -20,7 +20,7 @@ var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 
 var fundLabelFormat = ['${0} (${1})', 'code', 'year'];
 var fundSearchFormat = ['${0} (${1})', 'code', 'year'];
-var fundSearchFilter = {}; 
+var fundSearchFilter = {active : 't'};
 
 var cgi = new openils.CGI();
 var pcrud = new openils.PermaCrud();
@@ -112,7 +112,6 @@ function init2() {
     extraCopiesFund = new openils.widget.AutoFieldWidget({
         fmField : 'fund',
         fmClass : 'acqlid',
-        searchFilter : {active : 't'},
         labelFormat : fundLabelFormat,
         searchFormat : fundSearchFormat,
         searchFilter : fundSearchFilter,
@@ -635,9 +634,8 @@ function addInvoiceItem(item) {
     }
 
     if(item.fund_debit()) {
-        fundArgs.searchFilter = {'-or' : [{active : 't'}, {id : item.fund()}]};
+        fundArgs.searchFilter = {'-or' : [{ "-and": fundSearchFilter }, {id : item.fund()}]};
     } else {
-        fundArgs.searchFilter = {active : 't'}
         if(itemType && openils.Util.isTrue(itemType.prorate()))
             fundArgs.dijitArgs = {disabled : true};
     }