From 94ebb07056ea29fe9b121f29e4a08ecea8c8fb10 Mon Sep 17 00:00:00 2001 From: senator Date: Fri, 25 Jun 2010 16:00:36 +0000 Subject: [PATCH] Acq: fixing misc UI glitches Creating allocations and credits in the Funding Source Details interface didn't populate the appropriate grid immediately, but now it does. New tags didn't seem to persist in the Fund Details interface if you switched tabs and then came back to the Tags tab. Fixed. Changed some tab names of misc Acq interfaces to match their current names in the staff client menu. git-svn-id: svn://svn.open-ils.org/ILS/trunk@16815 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/acq/common/tag_manager.js | 6 +++++ .../web/js/ui/default/acq/financial/view_fund.js | 3 +++ .../default/acq/financial/view_funding_source.js | 28 ++++++++++++++-------- .../default/acq/financial/view_funding_source.tt2 | 1 + .../chrome/locale/en-US/offline.properties | 10 ++++---- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/common/tag_manager.js b/Open-ILS/web/js/ui/default/acq/common/tag_manager.js index c2086aa88..6a49421f9 100644 --- a/Open-ILS/web/js/ui/default/acq/common/tag_manager.js +++ b/Open-ILS/web/js/ui/default/acq/common/tag_manager.js @@ -57,6 +57,11 @@ function TagManager(displayNode) { dojo.destroy( "oils-acq-fund-tag-mapping-" + mapping.id() ); + fund.tags( + fund.tags().filter( + function(o) { return o.id() != mapping.id(); } + ) + ); }, "onerror": function() { /* XXX does onerror not actually work? */ @@ -81,6 +86,7 @@ function TagManager(displayNode) { "oncomplete": function(r, list) { mapping = list[0]; /* get the new mapping's ID this way */ mapping.tag(tag); /* re-"flesh" */ + fund.tags().push(mapping); /* save local reference */ dojo.place( self.renderTagMapping(mapping), self.displayNode, "last" diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js index 8a30a6c16..8eb04b000 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js @@ -66,6 +66,9 @@ function loadFundGrid() { function loadAllocationGrid() { if(fundAllocationGrid.isLoaded) return; + /* XXX If we want to show allocating user with a username instead of just + * ID#, the following pcrud search will have to be replaced with an API + * call. */ fundAllocationGrid.loadAll({order_by : {acqfa : 'create_time DESC'}}); fundAllocationGrid.isLoaded = true; } diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js index 070423adf..5a68df1b0 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js @@ -16,11 +16,11 @@ dojo.require('openils.widget.AutoGrid'); var ses = new OpenSRF.ClientSession('open-ils.acq'); var fundingSource = null; -function resetPage() { +function resetPage(also_load_grid) { fundingSource = null; fsCreditGrid.isLoaded = false; fsAllocationGrid.isLoaded = false; - loadFS(); + loadFS(also_load_grid); } function getFund(rowIndex, item) { @@ -32,17 +32,21 @@ function getFund(rowIndex, item) { /** creates a new funding_source_credit from the dialog ----- */ function applyFSCredit(fields) { fields.funding_source = fundingSourceID; - openils.acq.FundingSource.createCredit(fields, resetPage); + openils.acq.FundingSource.createCredit( + fields, function() { resetPage(loadCreditGrid); } + ); } function applyFSAllocation(fields) { fields.funding_source = fundingSourceID; if(isNaN(fields.amount)) fields.amount = null; - openils.acq.Fund.createAllocation(fields, resetPage); + openils.acq.Fund.createAllocation( + fields, function() { resetPage(loadAllocationGrid); } + ); } /** fetch the fleshed funding source ----- */ -function loadFS() { +function loadFS(also_load_grid) { var req = ses.request( 'open-ils.acq.funding_source.retrieve', openils.User.authtoken, fundingSourceID, @@ -58,6 +62,8 @@ function loadFS() { return; } loadFSGrid(); + if (typeof(also_load_grid) == "function") + also_load_grid(true /* reset_first */); } req.send(); } @@ -87,7 +93,7 @@ function formatFund(fund) { } } -/** builds the credits grid ----- */ +/** builds the summary grid ----- */ function loadFSGrid() { if(!fundingSource) return; var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])}); @@ -97,8 +103,9 @@ function loadFSGrid() { /** builds the credits grid ----- */ -function loadCreditGrid() { - if(fsCreditGrid.isLoaded) return; +function loadCreditGrid(reset_first) { + if (fsCreditGrid.isLoaded) return; + if (reset_first) fsCreditGrid.resetStore(); fsCreditGrid.loadAll( {"order_by": {"acqfscred": "effective_date DESC"}}, {"funding_source": fundingSource.id()} @@ -106,8 +113,9 @@ function loadCreditGrid() { fsCreditGrid.isLoaded = true; } -function loadAllocationGrid() { - if(fsAllocationGrid.isLoaded) return; +function loadAllocationGrid(reset_first) { + if (fsAllocationGrid.isLoaded) return; + if (reset_first) fsCreditGrid.resetStore(); fsAllocationGrid.loadAll( {"order_by": {"acqfa": "create_time DESC"}}, {"funding_source": fundingSource.id()} diff --git a/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 b/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 index 1e9511d4c..0c7d385e8 100644 --- a/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 @@ -125,6 +125,7 @@