From: erickson Date: Fri, 11 Apr 2008 21:52:49 +0000 (+0000) Subject: added a synchronous call to fetch the fund for the allocation list.. will make async. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=36fc836b9e59cc60a3d775b6ef9b1ce33157bb18;p=Evergreen.git added a synchronous call to fetch the fund for the allocation list.. will make async. git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9317 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html index e8eca7fb55..ce34729b64 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_funding_source.html @@ -13,8 +13,10 @@ dojo.require("dijit.form.CurrencyTextBox"); dojo.require('openils.acq.FundingSource'); + var ses = new OpenSRF.ClientSession('open-ils.acq'); var fundingSourceID = ${c.oils.acq.funding_source_id}; var fundingSource = null; + var fundCache = {}; /** creates a new funding_source_credit from the dialog ----- */ function applyFSCredit(fields) { @@ -29,11 +31,8 @@ /** fetch the fleshed funding source ----- */ function loadFS() { - var ses = new OpenSRF.ClientSession('open-ils.acq'); var req = ses.request( - 'open-ils.acq.funding_source.retrieve', - oilsAuthtoken, - fundingSourceID, + 'open-ils.acq.funding_source.retrieve', oilsAuthtoken, fundingSourceID, {flesh_summary:1, flesh_credits:1,flesh_allocations:1} ); @@ -59,6 +58,20 @@ case 4: return new String(fundingSource.summary().allocation_total); } } + + function getFund(rowIndex) { + /** synchronous version ... XXX need to refactor this to be async */ + data = fsAllocationGrid.model.getRow(rowIndex); + if(!data) return; + var fundId = data.fund; + if(!fundCache[fundId]) { + req = ses.request('open-ils.acq.fund.retrieve', oilsAuthtoken, fundId); + req.timeout = 10; + req.send(); + fundCache[fundId] = req.recv().content(); + } + return fundCache[fundId].name() + } /** builds the credits grid ----- */ function loadFSGrid() { @@ -177,7 +190,7 @@ var fsAllocationGridLayout = [{ cells : [[ {name: '${_("ID")}', field: 'id'}, - {name: '${_("Fund")}', field: "fund"}, + {name: '${_("Fund")}', field: "fund", get:getFund}, {name: '${_("Amount")}', field: "amount"}, {name: '${_("Percent")}', field: "percent"}, {name: '${_("Allocated By")}', field: "allocator"},