[open-ils-commits] r15107 - trunk/Open-ILS/web/js/ui/default/circ/selfcheck (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 8 16:21:08 EST 2009


Author: erickson
Date: 2009-12-08 16:21:03 -0500 (Tue, 08 Dec 2009)
New Revision: 15107

Modified:
   trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
Log:
plugged in holds list printing and progress dialog while waiting for template generation

Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js	2009-12-08 21:10:52 UTC (rev 15106)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js	2009-12-08 21:21:03 UTC (rev 15107)
@@ -397,7 +397,7 @@
 
     openils.Util.hide('oils-selfck-payment-page');
     openils.Util.hide('oils-selfck-holds-page');
-    openils.Util.show('oils-selfck-circ-page');
+    openils.Util.hide('oils-selfck-circ-page');
     
     switch(name) {
         case 'checkout':
@@ -558,6 +558,8 @@
         }
     );
 
+    this.holds = holds;
+
     progressDialog.hide();
 
     for(var i in holds) {
@@ -963,6 +965,8 @@
 
     if(!this.itemsOut.length) return;
 
+    progressDialog.show(true);
+
     var params = [
         this.authtoken, 
         this.staff.ws_ou(),
@@ -979,6 +983,7 @@
             async : true,
             params : params,
             oncomplete : function(r) {
+                progressDialog.hide();
                 var resp = openils.Util.readResponse(r);
                 var output = resp.template_output();
                 if(output) {
@@ -996,9 +1001,70 @@
     );
 }
 
+/**
+ * Print a receipt for this user's items out
+ */
+SelfCheckManager.prototype.printHoldsReceipt = function(callback) {
 
+    if(!this.holds.length) return;
 
+    progressDialog.show(true);
 
+    var holdIds = [];
+    var holdData = [];
+
+    dojo.forEach(this.holds,
+        function(data) {
+            holdIds.push(data.hold.id());
+            if(data.status == 4) {
+                holdData.push({ready : true});
+            } else {
+                holdData.push({
+                    queue_position : data.queue_position, 
+                    potential_copies : data.potential_copies
+                });
+            }
+        }
+    );
+
+    var params = [
+        this.authtoken, 
+        this.staff.ws_ou(),
+        null,
+        'format.selfcheck.holds',
+        'print-on-demand',
+        holdIds,
+        holdData
+    ];
+
+    var self = this;
+    fieldmapper.standardRequest(
+        ['open-ils.circ', 'open-ils.circ.fire_hold_trigger_events'],
+        {   
+            async : true,
+            params : params,
+            oncomplete : function(r) {
+                progressDialog.hide();
+                var resp = openils.Util.readResponse(r);
+                var output = resp.template_output();
+                if(output) {
+                    self.printData(output.data(), self.holds.length, callback); 
+                } else {
+                    var error = resp.error_output();
+                    if(error) {
+                        throw new Error("Error creating receipt: " + error.data());
+                    } else {
+                        throw new Error("No receipt data returned from server");
+                    }
+                }
+            }
+        }
+    );
+}
+
+
+
+
 /**
  * Logout the patron and return to the login page
  */



More information about the open-ils-commits mailing list