added support for abort transit -> check in -> check out in self check when COPY_IN_T...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 21 Dec 2009 20:22:35 +0000 (20:22 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 21 Dec 2009 20:22:35 +0000 (20:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15214 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 03e4321..5ed3baf 100644 (file)
@@ -828,7 +828,16 @@ SelfCheckManager.prototype.drawFinesPage = function() {
     );
 }
 
-SelfCheckManager.prototype.checkin = function(barcode) {
+SelfCheckManager.prototype.checkin = function(barcode, abortTransit) {
+
+    var resp = fieldmapper.standardRequest(
+        ['open-ils.circ', 'open-ils.circ.transit.abort'],
+        {params : [this.authtoken, {barcode : barcode}]}
+    );
+
+    // resp == 1 on success
+    if(openils.Event.parse(resp))
+        return false;
 
     var resp = fieldmapper.standardRequest(
         ['open-ils.circ', 'open-ils.circ.checkin.override'],
@@ -971,9 +980,6 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) {
 
         } else {
 
-            console.log(js2JSON(result.payload));
-            console.log(result.payload.copy.status() +' '+overrideEvents);
-
             if( // copy is marked lost.  if configured to do so, check it in and try again.
                 result.payload.copy && 
                 result.payload.copy.status() == /* LOST */ 3 &&
@@ -1012,6 +1018,16 @@ SelfCheckManager.prototype.handleXactResult = function(action, item, result) {
                     override = false;
                     break;
                 }
+
+                if(result[i].textcode == 'COPY_IN_TRANSIT') {
+                    // to override a transit, we have to abort the transit and check it in first
+                    if(this.checkin(item, true)) {
+                        return { doOver : true };
+                    } else {
+                        override = false;
+                    }
+
+                }
             }
 
             if(override)