From 5cdba9c5ceebab4be8b9111d7a5c9a9c0a9d6011 Mon Sep 17 00:00:00 2001 From: erickson Date: Sun, 13 Apr 2008 13:23:54 +0000 Subject: [PATCH] added some currency_type handling code. added some copyright headers. moving away from legacy org_utils.js code git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9324 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../oils/media/js/openils/acq/CurrencyType.js | 43 ++++++++++++++++++++++ .../public/oils/media/js/openils/acq/Fund.js | 16 ++++++++ .../oils/media/js/openils/acq/FundingSource.js | 16 ++++++++ .../public/oils/media/js/openils/acq/Provider.js | 16 ++++++++ .../web/oilsweb/oilsweb/templates/oils/base.html | 2 +- .../acq/financial/list_funding_sources.html | 9 +++-- .../default/acq/financial/view_funding_source.html | 2 +- 7 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js new file mode 100644 index 0000000000..7b1fecb154 --- /dev/null +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/CurrencyType.js @@ -0,0 +1,43 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + +if(!dojo._hasResource["openils.acq.CurrencyType"]) { + + dojo._hasResource["openils.acq.CurrencyType"] = true; + dojo.provide("openils.acq.CurrencyType"); + dojo.declare('openils.acq.CurrencyType', null, { + }); + + openils.acq.CurrencyType.cache = {}; + + /** + * Retrieves all of the currency types + */ + openils.acq.CurrencyType.fetchAll = function(onComplete) { + var req = new OpenSRF.ClientSession('open-ils.acq').request( + 'open-ils.acq.currency_type.all.retrieve', oilsAuthtoken); + + req.oncomplete = function(r) { + var msg = r.recv(); + var types = msg.content(); + for(var i in types) + openils.acq.CurrencyType.cache[types[i].code()] = types[i]; + onComplete(types); + } + req.send(); + } +} + diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js index 81de471ff7..0e2054e531 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js @@ -1,3 +1,19 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + if(!dojo._hasResource['openils.acq.Fund']) { dojo._hasResource['openils.acq.Fund'] = true; dojo.provide('openils.acq.Fund'); diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js index ef92629bc2..a280ef2784 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js @@ -1,3 +1,19 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + if(!dojo._hasResource['openils.acq.FundingSource']) { dojo._hasResource['openils.acq.FundingSource'] = true; dojo.provide('openils.acq.FundingSource'); diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js index f0a674ff7a..753aa9c92e 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js @@ -1,3 +1,19 @@ +/* --------------------------------------------------------------------------- + * Copyright (C) 2008 Georgia Public Library Service + * Bill Erickson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * --------------------------------------------------------------------------- + */ + if(!dojo._hasResource['openils.acq.Provider']) { dojo._hasResource['openils.acq.Provider'] = true; dojo.provide('openils.acq.Provider'); diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html index 25edaeb413..4b1b581b8a 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/base.html @@ -46,7 +46,6 @@ - @@ -65,6 +64,7 @@ dojo.require("dojox.grid.Grid"); dojo.require("dojox.grid._data.model"); dojo.require("fieldmapper.dojoData"); + dojo.require("fieldmapper.OrgUtils"); diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html index f96330dad1..9070e7f54b 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/list_funding_sources.html @@ -12,6 +12,8 @@ dojo.require("dijit.Dialog"); dojo.require("dijit.form.FilteringSelect"); dojo.require('openils.acq.FundingSource'); + dojo.require('openils.Event'); + dojo.require('openils.acq.CurrencyType'); function createFS(fields) { /** Creates a new funding source */ openils.acq.FundingSource.create( @@ -36,7 +38,7 @@ - @@ -81,7 +83,7 @@ function getOrgInfo(rowIndex) { data = fundingSourceListGrid.model.getRow(rowIndex); if(!data) return; - return findOrgUnit(data.owner).name(); /* XXX show shortname by default, but needs fetching */ + return fieldmapper.aou.findOrgUnit(data.owner).shortname(); } function getBalanceInfo(rowIndex) { @@ -109,7 +111,8 @@ openils.acq.FundingSource.createStore( function(storeData) { var store = new dojo.data.ItemFileWriteStore({data:storeData}); - var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + var model = new dojox.grid.data.DojoData(null, store, + {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); fundingSourceListGrid.setStructure(gridStructure); fundingSourceListGrid.setModel(model); fundingSourceListGrid.update(); 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 ce34729b64..2b662a0dc2 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 @@ -48,7 +48,7 @@ function getOrgInfo(rowIndex) { data = fundingSourceGrid.model.getRow(rowIndex); if(!data) return; - return findOrgUnit(data.owner).name(); /* XXX show shortname by default, but needs fetching */ + return fieldmapper.aou.findOrgUnit(data.owner).shortname(); } function getSummaryInfo(rowIndex) { -- 2.11.0