[open-ils-commits] r9640 - branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq

svn at svn.open-ils.org svn at svn.open-ils.org
Mon May 19 12:23:37 EDT 2008


Author: erickson
Date: 2008-05-19 12:23:35 -0400 (Mon, 19 May 2008)
New Revision: 9640

Added:
   branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js
Log:
adding general PO js

Added: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/PO.js	2008-05-19 16:23:35 UTC (rev 9640)
@@ -0,0 +1,54 @@
+/* ---------------------------------------------------------------------------
+ * Copyright (C) 2008  Georgia Public Library Service
+ * Bill Erickson <erickson at 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.PO']) {
+
+    dojo._hasResource['openils.acq.PO'] = true;
+    dojo.provide('openils.acq.PO');
+    dojo.require('fieldmapper.Fieldmapper');
+    dojo.require('fieldmapper.dojoData');
+
+    /** Declare the PO class with dojo */
+    dojo.declare('openils.acq.PO', null, {
+        /* add instance methods here if necessary */
+    });
+
+    openils.acq.PO.cache = {};
+
+    openils.acq.PO.retrieve = function(id, oncomplete) {
+
+        var req = ['open-ils.acq', 'open-ils.acq.purchase_order.retrieve'];
+        var par = [openils.User.authtoken, id];
+
+        if(oncomplete) {
+            fieldmapper.standardRequest(
+                req, 
+                {   params:par, 
+                    oncomplete:function(r) {
+                        var po = r.recv().content();
+                        openils.acq.PO.cache[po.id()] = po;
+                        oncomplete(po);
+                    }
+                }
+            );
+        } else {
+            return openils.acq.PO.cache[po.id()] = 
+                fieldmapper.standardRequest(req, par);
+        }
+    }
+};
+        
+



More information about the open-ils-commits mailing list