From: Bill Erickson Date: Fri, 23 Mar 2012 16:06:53 +0000 (-0400) Subject: acq fund : balance getter, fleshed funds, filter dialog X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=27cc7be353c9dbf613a65e47b1c8be8d2490b486;p=evergreen%2Fequinox.git acq fund : balance getter, fleshed funds, filter dialog Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/acq/fund/list.tt2 b/Open-ILS/src/templates/acq/fund/list.tt2 index c70e1a1dc7..95eac5fe45 100644 --- a/Open-ILS/src/templates/acq/fund/list.tt2 +++ b/Open-ILS/src/templates/acq/fund/list.tt2 @@ -146,6 +146,7 @@ requiredFields="['name', 'code', 'year', 'org', 'currency_type']" query="{id: '*'}" fmClass='acqf' + showLoadFilter='true' showPaginator='true' editOnEnter='true'> diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js index 276f89a57f..763ee2b262 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js @@ -32,6 +32,7 @@ var fundFleshFields = [ ]; var adminPermOrgs = []; +var cachedFunds = []; function initPage() { contextOrg = openils.User.user.ws_ou(); @@ -48,7 +49,8 @@ function initPage() { ); }; - dojo.connect(refreshButton, 'onClick', function() { rolloverMode = false; gridDataLoader(); }); + dojo.connect(refreshButton, 'onClick', + function() { rolloverMode = false; gridDataLoader(); }); new openils.User().buildPermOrgSelector( ['ADMIN_ACQ_FUND', 'VIEW_FUND'], @@ -58,7 +60,8 @@ function initPage() { fieldmapper.aou.findOrgUnit(contextOrg).shortname(); loadYearSelector(); - lfGrid.dataLoader = gridDataLoader; + //lfGrid.dataLoader = gridDataLoader; + lfGrid.onItemReceived = function(item) {cachedFunds.push(item)}; new openils.User().getPermOrgList( 'ADMIN_ACQ_FUND', @@ -87,11 +90,44 @@ function gridDataLoader() { } } +function getBalanceInfo(rowIdx, item) { + if (!item) return ''; + var fundId = this.grid.store.getValue(item, 'id'); + var fund = cachedFunds.filter(function(f) { return f.id() == fundId })[0]; + var cb = fund.combined_balance(); + return cb ? cb.amount() : '0'; +} + function loadFundGrid(year) { openils.Util.hide('acq-fund-list-rollover-summary'); year = year || fundFilterYearSelect.attr('value'); + cachedFunds = []; + + lfGrid.loadAll( + { + flesh : 1, + flesh_fields : {acqf : fundFleshFields}, + + // by default, sort funds I can edit to the front + order_by : [ + { 'class' : 'acqf', + field : 'org', + compare : {'in' : adminPermOrgs}, + direction : 'desc' + }, + { 'class' : 'acqf', + field : 'name' + } + ] + }, { + year : year, + org : fieldmapper.aou.descendantNodeList(contextOrg, true) + } + ); + + /* var pcrud = new openils.PermaCrud(); pcrud.search('acqf', { year : year, @@ -124,6 +160,7 @@ function loadFundGrid(year) { } } ); + */ } function loadYearSelector() {