[open-ils-commits] r15212 - trunk/Open-ILS/web/js/ui/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 21 15:07:11 EST 2009
Author: erickson
Date: 2009-12-21 15:07:06 -0500 (Mon, 21 Dec 2009)
New Revision: 15212
Modified:
trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
Log:
added support to self-check for handling lost items. If COPY_STATUS_LOST is in the self-check override list, the system will forcably check the item in then check it out to the new patron
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-21 20:02:20 UTC (rev 15211)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-21 20:07:06 UTC (rev 15212)
@@ -828,7 +828,32 @@
);
}
+SelfCheckManager.prototype.checkin = function(barcode) {
+ var resp = fieldmapper.standardRequest(
+ ['open-ils.circ', 'open-ils.circ.checkin.override'],
+ {params : [
+ this.authtoken, {
+ patron_id : this.patron.id(),
+ copy_barcode : barcode,
+ noop : true
+ }
+ ]}
+ );
+
+ if(!resp.length) resp = [resp];
+ for(var i = 0; i < resp.length; i++) {
+ var tc = openils.Event.parse(resp[i]).textcode;
+ if(tc == 'SUCCESS' || tc == 'NO_CHANGE') {
+ continue;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
/**
* Check out a single item. If the item is already checked
* out to the patron, redirect to renew()
@@ -867,12 +892,12 @@
]}
);
- console.log(js2JSON(result));
-
var stat = this.handleXactResult('checkout', barcode, result);
if(stat.override) {
this.checkout(barcode, true);
+ } else if(stat.doOver) {
+ this.checkout(barcode);
} else if(stat.renew) {
this.renew(barcode);
}
@@ -886,12 +911,9 @@
// If true, the display message is important enough to pop up. Whether or not
// an alert() actually occurs, depends on org unit settings
var popup = false;
-
- var sound = '';
-
- // TODO handle lost/missing/etc checkin+checkout override steps
-
+ var sound = ''; // sound file reference
var payload = result.payload || {};
+ var overrideEvents = this.orgSettings[SET_AUTO_OVERRIDE_EVENTS];
if(result.textcode == 'NO_SESSION') {
@@ -948,6 +970,21 @@
displayText = dojo.string.substitute(localeStrings.ALREADY_OUT, [item]);
} 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 &&
+ overrideEvents && overrideEvents.length &&
+ overrideEvents.indexOf('COPY_STATUS_LOST') != -1) {
+
+ if(this.checkin(item)) {
+ return { doOver : true };
+ }
+ }
+
// item is checked out to some other user
popup = true;
@@ -959,7 +996,6 @@
} else {
- var overrideEvents = this.orgSettings[SET_AUTO_OVERRIDE_EVENTS];
if(overrideEvents && overrideEvents.length) {
@@ -1009,6 +1045,7 @@
case 'OPEN_CIRCULATION_EXISTS' :
displayText = dojo.string.substitute(
localeStrings.OPEN_CIRCULATION_EXISTS, [item]);
+
break;
default:
More information about the open-ils-commits
mailing list