[open-ils-commits] r13149 - trunk/Open-ILS/web/js/ui/default/acq/financial (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 12 16:39:34 EDT 2009
Author: erickson
Date: 2009-05-12 16:39:30 -0400 (Tue, 12 May 2009)
New Revision: 13149
Modified:
trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js
trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
Log:
cache has no object when a new object is created. if not in the cache, assume balance, etc. info of '0'
Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js 2009-05-12 20:06:08 UTC (rev 13148)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_funding_sources.js 2009-05-12 20:39:30 UTC (rev 13149)
@@ -19,8 +19,11 @@
function getBalanceInfo(rowIndex, item) {
if(!item) return '';
- var data = this.grid.store.getValue( item, 'id');
- return new String(openils.acq.FundingSource.cache[data].summary().balance);
+ var id = this.grid.store.getValue( item, 'id');
+ var fs = openils.acq.FundingSource.cache[id];
+ if(fs && fs.summary())
+ return fs.summary().balance;
+ return 0;
}
function loadFSGrid() {
Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js 2009-05-12 20:06:08 UTC (rev 13148)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/list_funds.js 2009-05-12 20:39:30 UTC (rev 13149)
@@ -11,30 +11,31 @@
dojo.require('openils.widget.AutoGrid');
function getOrgInfo(rowIndex, item) {
-
if(!item) return '';
var owner = this.grid.store.getValue(item, 'org');
return fieldmapper.aou.findOrgUnit(owner).shortname();
-
}
function getBalanceInfo(rowIndex, item) {
if(!item) return '';
- var data = this.grid.store.getValue( item, 'id');
- return new String(openils.acq.Fund.cache[data].summary().combined_balance);
+ var id = this.grid.store.getValue( item, 'id');
+ var fund = openils.acq.Fund.cache[id];
+ if(fund && fund.summary())
+ return fund.summary().combined_balance;
+ return 0;
}
function loadFundGrid() {
var yearStore = {identifier:'year', name:'year', items:[]};
var yearsAdded = {}; /* don't duplicate the years in the selector */
-
+
fieldmapper.standardRequest(
[ 'open-ils.acq', 'open-ils.acq.fund.org.retrieve'],
{ async: true,
params: [openils.User.authtoken, null, {flesh_summary:1}],
onresponse : function(r) {
if(lf = openils.Util.readResponse(r)) {
- openils.acq.Fund.cache[lf.id()] = lf;
+ openils.acq.Fund.cache[lf.id()] = lf;
lfGrid.store.newItem(acqf.toStoreItem(lf));
var year = lf.year();
if(!(year in yearsAdded)) {
@@ -56,7 +57,6 @@
}
function filterGrid() {
- console.log('filtergrid called');
var year = fundFilterYearSelect.getValue();
console.log(year);
if(year)
More information about the open-ils-commits
mailing list