now updating circ and hold summary numbers. during checkout, update the total and...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 23 Nov 2009 17:13:14 +0000 (17:13 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 23 Nov 2009 17:13:14 +0000 (17:13 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15006 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js

index 145c2c6..0330c7a 100644 (file)
@@ -278,7 +278,7 @@ SelfCheckManager.prototype.drawCircPage = function() {
     }
 }
 
-SelfCheckManager.prototype.updateHoldsSummary = function(decrement) {
+SelfCheckManager.prototype.updateHoldsSummary = function() {
 
     if(!this.holdsSummary) {
         var summary = fieldmapper.standardRequest(
@@ -294,9 +294,6 @@ SelfCheckManager.prototype.updateHoldsSummary = function(decrement) {
             this.holdsSummary.total += Number(summary[i]);
     }
 
-    if(this.decrement) 
-        this.holdsSummary.ready -= 1;
-
     dojo.byId('oils-selfck-holds-total').innerHTML = 
         dojo.string.substitute(
             localeStrings.TOTAL_HOLDS, 
@@ -500,6 +497,8 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) {
     var popup = false;  
 
     // TODO handle lost/missing/etc checkin+checkout override steps
+    
+    var payload = result.payload || {};
         
     if(result.textcode == 'NO_SESSION') {
 
@@ -509,15 +508,22 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) {
 
         if(action == 'checkout') {
 
-            displayText = dojo.string.substitute(
-                localeStrings.CHECKOUT_SUCCESS, [item]);
-                this.displayCheckout(result, 'checkout');
+            displayText = dojo.string.substitute(localeStrings.CHECKOUT_SUCCESS, [item]);
+            this.displayCheckout(result, 'checkout');
+
+            if(payload.holds_fulfilled && payload.holds_fulfilled.length) {
+                // A hold was fulfilled, update the hold numbers in the circ summary
+                console.log("fulfilled hold " + payload.holds_fulfilled + " during checkout");
+                this.holdsSummary = null;
+                this.updateHoldsSummary();
+            }
+
+            this.updateCircSummary(true);
 
         } else if(action == 'renew') {
 
-            displayText = dojo.string.substitute(
-                localeStrings.RENEW_SUCCESS, [item]);
-                this.displayCheckout(result, 'renew');
+            displayText = dojo.string.substitute(localeStrings.RENEW_SUCCESS, [item]);
+            this.displayCheckout(result, 'renew');
         }
 
         this.updateScanBox();
@@ -527,8 +533,6 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) {
         // Server says the item is already checked out.  If it's checked out to the
         // current user, we may need to renew it.  
 
-        var payload = result.payload || {};
-
         if(payload.old_circ) { 
 
             /*