--- /dev/null
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008 Georgia Public Library Service
+ * Bill Erickson <erickson@esilibrary.com>
+ *
+ * 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', openils.User.authtoken);
+
+ 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();
+ }
+}
+
--- /dev/null
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008 Georgia Public Library Service
+ * Bill Erickson <erickson@esilibrary.com>
+ *
+ * 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');
+dojo.require('util.Dojo');
+
+/** Declare the Fund class with dojo */
+dojo.declare('openils.acq.Fund', null, {
+ /* add instance methods here if necessary */
+});
+
+
+openils.acq.Fund.loadGrid = function(domId, columns) {
+ /** Fetches the list of funds and builds a grid from them */
+
+ var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.fund.org.retrieve',
+ openils.User.authtoken, null, {flesh_summary:1});
+
+ req.oncomplete = function(r) {
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ while(msg = r.recv()) {
+ var fund = msg.content();
+ gridRefs.store.newItem({
+ id:fund.id(),
+ name:fund.name(),
+ org: findOrgUnit(fund.org()).name(),
+ currency_type:fund.currency_type(),
+ year:fund.year(),
+ combined_balance:fund.summary()['combined_balance']
+ });
+ }
+ gridRefs.grid.update();
+ };
+
+ req.send();
+ return gridRefs.grid;
+};
+}
+
--- /dev/null
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008 Georgia Public Library Service
+ * Bill Erickson <erickson@esilibrary.com>
+ *
+ * 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');
+
+/** Declare the FundingSource class with dojo */
+dojo.declare('openils.acq.FundingSource', null, {
+ /* add instance methods here if necessary */
+});
+
+/** cached funding_source objects */
+openils.acq.FundingSource.cache = {};
+
+openils.acq.FundingSource.createStore = function(onComplete) {
+ /** Fetches the list of funding_sources and builds a grid from them */
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.funding_source.org.retrieve',
+ openils.User.authtoken, null, {flesh_summary:1});
+
+ req.oncomplete = function(r) {
+ var msg
+ var items = [];
+ var src = null;
+ while(msg = r.recv()) {
+ src = msg.content();
+ openils.acq.FundingSource.cache[src.id()] = src;
+ items.push(src);
+ }
+ onComplete(acqfs.toStoreData(items));
+ };
+
+ req.send();
+};
+
+
+
+/**
+ * Create a new funding source object
+ * @param fields Key/value pairs used to create the new funding source
+ */
+openils.acq.FundingSource.create = function(fields, onCreateComplete) {
+
+ var fs = new acqfs()
+ for(var field in fields)
+ fs[field](fields[field]);
+
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.funding_source.create', openils.User.authtoken, fs);
+
+ req.oncomplete = function(r) {
+ var msg = r.recv();
+ var id = msg.content();
+ if(onCreateComplete)
+ onCreateComplete(id);
+ };
+ req.send();
+};
+
+
+openils.acq.FundingSource.createCredit = function(fields, onCreateComplete) {
+
+ var fsc = new acqfscred()
+ for(var field in fields)
+ fsc[field](fields[field]);
+
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request(
+ 'open-ils.acq.funding_source_credit.create', openils.User.authtoken, fsc);
+
+ req.oncomplete = function(r) {
+ var msg = r.recv();
+ var id = msg.content();
+ if(onCreateComplete)
+ onCreateComplete(id);
+ };
+ req.send();
+};
+
+
+openils.acq.FundingSource.deleteFromGrid = function(grid, onComplete) {
+ var list = []
+ var selected = grid.selection.getSelected();
+ for(var rowIdx in selected)
+ list.push(grid.model.getDatum(selected[rowIdx], 0));
+ openils.acq.FundingSource.deleteList(list, onComplete);
+};
+
+openils.acq.FundingSource.deleteList = function(list, onComplete) {
+ openils.acq.FundingSource._deleteList(list, 0, onComplete);
+}
+
+openils.acq.FundingSource._deleteList = function(list, idx, onComplete) {
+ if(idx >= list.length)
+ return onComplete();
+
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.funding_source.delete', openils.User.authtoken, list[idx]);
+ delete openils.acq.FundingSource.cache[list[idx]];
+
+ req.oncomplete = function(r) {
+ msg = r.recv()
+ stat = msg.content();
+ /* XXX CHECH FOR EVENT */
+ openils.acq.FundingSource._deleteList(list, ++idx, onComplete);
+ }
+ req.send();
+};
+
+
+} /* end dojo._hasResource[] */
--- /dev/null
+if(!dojo._hasResource['openils.acq.Picklist']) {
+dojo._hasResource['openils.acq.Picklist'] = true;
+dojo.provide('openils.acq.Picklist');
+dojo.require('util.Dojo');
+
+/** Declare the Picklist class with dojo */
+dojo.declare('openils.acq.Picklist', null, {
+ /* add instance methods here if necessary */
+});
+
+ openils.acq.Picklist.find_attr = function(li, at_name, at_type) {
+ for (var i in li.attributes()) {
+ var attr = li.attributes()[i];
+ if (attr.attr_type() == at_type && attr.attr_name() == at_name) {
+ return attr.attr_value();
+ }
+ }
+ return '';
+ };
+
+
+ openils.acq.Picklist.loadGrid = function(domId, columns, pl_id) {
+ /** Fetches the list of picklists and builds a grid from them */
+
+ var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.lineitem.picklist.retrieve',
+ openils.User.authtoken, pl_id, {flesh_attrs:1});
+
+ req.oncomplete = function(r) {
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ gridRefs.model.query = {id:'*'};
+ while(msg = r.recv()) {
+ var jub = msg.content();
+ //alert(js2JSON(jub));
+ gridRefs.store.newItem({
+ id:jub.id(),
+ title:openils.acq.Picklist.find_attr(jub, "title", "lineitem_marc_attr_definition"),
+ price:openils.acq.Picklist.find_attr(jub, "price", "lineitem_marc_attr_definition"),
+ provider:jub.provider(),
+ copies:jub.item_count()
+ });
+ }
+ gridRefs.grid.update();
+ };
+
+ req.send();
+ return gridRefs.grid;
+};
+}
+
--- /dev/null
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008 Georgia Public Library Service
+ * Bill Erickson <erickson@esilibrary.com>
+ *
+ * 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');
+dojo.require('util.Dojo');
+
+/** Declare the Provider class with dojo */
+dojo.declare('openils.acq.Provider', null, {
+ /* add instance methods here if necessary */
+});
+
+/* define some static provider methods ------- */
+
+openils.acq.Provider.loadGrid = function(domId, columns) {
+ /** Fetches the list of providers and builds a grid from them */
+
+ var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
+ var ses = new OpenSRF.ClientSession('open-ils.acq');
+ var req = ses.request('open-ils.acq.provider.org.retrieve', openils.User.authtoken);
+
+ req.oncomplete = function(r) {
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ while(msg = r.recv()) {
+ var prov = msg.content();
+ gridRefs.store.newItem({
+ id:prov.id(),
+ name:prov.name(),
+ owner: findOrgUnit(prov.owner()).name(),
+ currency_type:prov.currency_type()
+ });
+ }
+ gridRefs.grid.update();
+ };
+
+ req.send();
+ return gridRefs.grid;
+};
+}
+
+++ /dev/null
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2008 Georgia Public Library Service
- * Bill Erickson <erickson@esilibrary.com>
- *
- * 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', openils.User.authtoken);
-
- 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();
- }
-}
-
+++ /dev/null
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2008 Georgia Public Library Service
- * Bill Erickson <erickson@esilibrary.com>
- *
- * 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');
-dojo.require('util.Dojo');
-
-/** Declare the Fund class with dojo */
-dojo.declare('openils.acq.Fund', null, {
- /* add instance methods here if necessary */
-});
-
-
-openils.acq.Fund.loadGrid = function(domId, columns) {
- /** Fetches the list of funds and builds a grid from them */
-
- var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.fund.org.retrieve',
- openils.User.authtoken, null, {flesh_summary:1});
-
- req.oncomplete = function(r) {
- var msg
- gridRefs.grid.setModel(gridRefs.model);
- while(msg = r.recv()) {
- var fund = msg.content();
- gridRefs.store.newItem({
- id:fund.id(),
- name:fund.name(),
- org: findOrgUnit(fund.org()).name(),
- currency_type:fund.currency_type(),
- year:fund.year(),
- combined_balance:fund.summary()['combined_balance']
- });
- }
- gridRefs.grid.update();
- };
-
- req.send();
- return gridRefs.grid;
-};
-}
-
+++ /dev/null
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2008 Georgia Public Library Service
- * Bill Erickson <erickson@esilibrary.com>
- *
- * 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');
-dojo.require('util.Dojo');
-
-/** Declare the FundingSource class with dojo */
-dojo.declare('openils.acq.FundingSource', null, {
- /* add instance methods here if necessary */
-});
-
-/** cached funding_source objects */
-openils.acq.FundingSource.cache = {};
-
-openils.acq.FundingSource.createStore = function(onComplete) {
- /** Fetches the list of funding_sources and builds a grid from them */
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.funding_source.org.retrieve',
- openils.User.authtoken, null, {flesh_summary:1});
-
- req.oncomplete = function(r) {
- var msg
- var items = [];
- var src = null;
- while(msg = r.recv()) {
- src = msg.content();
- openils.acq.FundingSource.cache[src.id()] = src;
- items.push(src);
- }
- onComplete(acqfs.toStoreData(items));
- };
-
- req.send();
-};
-
-
-
-/**
- * Create a new funding source object
- * @param fields Key/value pairs used to create the new funding source
- */
-openils.acq.FundingSource.create = function(fields, onCreateComplete) {
-
- var fs = new acqfs()
- for(var field in fields)
- fs[field](fields[field]);
-
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.funding_source.create', openils.User.authtoken, fs);
-
- req.oncomplete = function(r) {
- var msg = r.recv();
- var id = msg.content();
- if(onCreateComplete)
- onCreateComplete(id);
- };
- req.send();
-};
-
-
-openils.acq.FundingSource.createCredit = function(fields, onCreateComplete) {
-
- var fsc = new acqfscred()
- for(var field in fields)
- fsc[field](fields[field]);
-
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request(
- 'open-ils.acq.funding_source_credit.create', openils.User.authtoken, fsc);
-
- req.oncomplete = function(r) {
- var msg = r.recv();
- var id = msg.content();
- if(onCreateComplete)
- onCreateComplete(id);
- };
- req.send();
-};
-
-
-openils.acq.FundingSource.deleteFromGrid = function(grid, onComplete) {
- var list = []
- var selected = grid.selection.getSelected();
- for(var rowIdx in selected)
- list.push(grid.model.getDatum(selected[rowIdx], 0));
- openils.acq.FundingSource.deleteList(list, onComplete);
-};
-
-openils.acq.FundingSource.deleteList = function(list, onComplete) {
- openils.acq.FundingSource._deleteList(list, 0, onComplete);
-}
-
-openils.acq.FundingSource._deleteList = function(list, idx, onComplete) {
- if(idx >= list.length)
- return onComplete();
-
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.funding_source.delete', openils.User.authtoken, list[idx]);
- delete openils.acq.FundingSource.cache[list[idx]];
-
- req.oncomplete = function(r) {
- msg = r.recv()
- stat = msg.content();
- /* XXX CHECH FOR EVENT */
- openils.acq.FundingSource._deleteList(list, ++idx, onComplete);
- }
- req.send();
-};
-
-
-} /* end dojo._hasResource[] */
+++ /dev/null
-if(!dojo._hasResource['openils.acq.Picklist']) {
-dojo._hasResource['openils.acq.Picklist'] = true;
-dojo.provide('openils.acq.Picklist');
-dojo.require('util.Dojo');
-
-/** Declare the Picklist class with dojo */
-dojo.declare('openils.acq.Picklist', null, {
- /* add instance methods here if necessary */
-});
-
- openils.acq.Picklist.find_attr = function(li, at_name, at_type) {
- for (var i in li.attributes()) {
- var attr = li.attributes()[i];
- if (attr.attr_type() == at_type && attr.attr_name() == at_name) {
- return attr.attr_value();
- }
- }
- return '';
- };
-
-
- openils.acq.Picklist.loadGrid = function(domId, columns, pl_id) {
- /** Fetches the list of picklists and builds a grid from them */
-
- var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.lineitem.picklist.retrieve',
- openils.User.authtoken, pl_id, {flesh_attrs:1});
-
- req.oncomplete = function(r) {
- var msg
- gridRefs.grid.setModel(gridRefs.model);
- gridRefs.model.query = {id:'*'};
- while(msg = r.recv()) {
- var jub = msg.content();
- //alert(js2JSON(jub));
- gridRefs.store.newItem({
- id:jub.id(),
- title:openils.acq.Picklist.find_attr(jub, "title", "lineitem_marc_attr_definition"),
- price:openils.acq.Picklist.find_attr(jub, "price", "lineitem_marc_attr_definition"),
- provider:jub.provider(),
- copies:jub.item_count()
- });
- }
- gridRefs.grid.update();
- };
-
- req.send();
- return gridRefs.grid;
-};
-}
-
+++ /dev/null
-/* ---------------------------------------------------------------------------
- * Copyright (C) 2008 Georgia Public Library Service
- * Bill Erickson <erickson@esilibrary.com>
- *
- * 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');
-dojo.require('util.Dojo');
-
-/** Declare the Provider class with dojo */
-dojo.declare('openils.acq.Provider', null, {
- /* add instance methods here if necessary */
-});
-
-/* define some static provider methods ------- */
-
-openils.acq.Provider.loadGrid = function(domId, columns) {
- /** Fetches the list of providers and builds a grid from them */
-
- var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
- var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.provider.org.retrieve', openils.User.authtoken);
-
- req.oncomplete = function(r) {
- var msg
- gridRefs.grid.setModel(gridRefs.model);
- while(msg = r.recv()) {
- var prov = msg.content();
- gridRefs.store.newItem({
- id:prov.id(),
- name:prov.name(),
- owner: findOrgUnit(prov.owner()).name(),
- currency_type:prov.currency_type()
- });
- }
- gridRefs.grid.update();
- };
-
- req.send();
- return gridRefs.grid;
-};
-}
-