1 /* ---------------------------------------------------------------------------
2 * Copyright (C) 2008 Georgia Public Library Service
3 * Bill Erickson <erickson@esilibrary.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * ---------------------------------------------------------------------------
17 if(!dojo._hasResource["openils.acq.CurrencyType"]) {
19 dojo._hasResource["openils.acq.CurrencyType"] = true;
20 dojo.provide("openils.acq.CurrencyType");
21 dojo.require('openils.User');
22 dojo.require('openils.Util');
23 dojo.require('openils.PermaCrud');
25 dojo.declare('openils.acq.CurrencyType', null, {
28 openils.acq.CurrencyType.cache = {};
31 * Retrieves all of the currency types
33 openils.acq.CurrencyType.fetchAll = function(onComplete) {
35 var pcrud = new openils.PermaCrud();
36 pcrud.retrieveAll('acqct', {
38 oncomplete : function(r) {
39 var types = openils.Util.readResponse(r);
41 openils.acq.CurrencyType.cache[types[idx].code()] = types[idx];
47 openils.acq.CurrencyType.loadSelectWidget = function(selector) {
48 openils.acq.CurrencyType.fetchAll(
50 selector.store = new dojo.data.ItemFileReadStore(
51 {data:acqct.toStoreData(ctypes, 'code', {identifier:'code'})});
52 selector.setValue(ctypes[0].code()); /* XXX get from setting */