[open-ils-commits] r14082 - in trunk/Open-ILS/xul/staff_client/server: circ locale/en-US (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Sep 22 01:22:03 EDT 2009
Author: phasefx
Date: 2009-09-22 01:21:59 -0400 (Tue, 22 Sep 2009)
New Revision: 14082
Modified:
trunk/Open-ILS/xul/staff_client/server/circ/checkout.js
trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Log:
New behavior for checkout attempt against an open circulation:
If existing circ is for a different patron, offer:
Cancel
Normal Checkin then Checkout
(if Overdue) Forgiving Checkin then Checkout
If existing circ is for the same patron, offer:
Cancel
Normal Checkin then Checkout
Renew
Unless circ.checkout_auto_renew_age is set and the circulation is older than that specified interval, in which case, automatically try a renewal instead of a checkout.
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkout.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkout.js 2009-09-22 03:54:02 UTC (rev 14081)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkout.js 2009-09-22 05:21:59 UTC (rev 14082)
@@ -466,7 +466,33 @@
}
} else {
- throw(checkout);
+ // Should get here with failed renewals
+ switch(Number(checkout.ilsevent)) {
+ case null /* custom event */ :
+ case 5000 /* PERM_FAILURE */:
+ case 1212 /* PATRON_EXCEEDS_OVERDUE_COUNT */ :
+ case 1213 /* PATRON_BARRED */ :
+ case 1215 /* CIRC_EXCEEDS_COPY_RANGE */ :
+ case 1224 /* PATRON_ACCOUNT_EXPIRED */ :
+ case 1232 /* ITEM_DEPOSIT_REQUIRED */ :
+ case 1233 /* ITEM_RENTAL_FEE_REQUIRED */ :
+ case 1234 /* ITEM_DEPOSIT_PAID */ :
+ case 1500 /* ACTION_CIRCULATION_NOT_FOUND */ :
+ case 7002 /* PATRON_EXCEEDS_CHECKOUT_COUNT */ :
+ case 7003 /* COPY_CIRC_NOT_ALLOWED */ :
+ case 7004 /* COPY_NOT_AVAILABLE */ :
+ case 7006 /* COPY_IS_REFERENCE */ :
+ case 7007 /* COPY_NEEDED_FOR_HOLD */ :
+ case 7008 /* MAX_RENEWALS_REACHED */ :
+ case 7009 /* CIRC_CLAIMS_RETURNED */ :
+ case 7010 /* COPY_ALERT_MESSAGE */ :
+ case 7013 /* PATRON_EXCEEDS_FINES */ :
+ x.setAttribute('style','color: red');
+ x.setAttribute('value', document.getElementById('circStrings').getFormattedString('staff.circ.checkout.barcode.failed', [params.barcode]));
+ if (typeof params.noncat == 'undefined') { obj.items_out_count--; }
+ break;
+ default: throw(checkout);
+ }
}
} catch(E) {
@@ -797,39 +823,93 @@
case 1702 /* OPEN_CIRCULATION_EXISTS */ :
msg += test_permit[i].desc + '\n';
found_handled = true;
+ var foreign_circ = true;
+ var my_circ;
- var my_copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[params.barcode]);
- if (typeof my_copy.ilsevent != 'undefined') { throw(my_copy); }
- var my_circ = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),my_copy.id(),1]);
- if (typeof my_circ.ilsevent != 'undefined') { throw(my_copy); }
- my_circ = my_circ[0];
- var due_date = my_circ.due_date() ? my_circ.due_date().substr(0,10) : null;
- JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
- if (due_date) {
- if (today > due_date) {
- msg += (document.getElementById('circStrings').getFormattedString('staff.circ.checkout.item_due', [due_date]) + '\n');
- }
- }
+ var payload = test_permit[i].payload;
+ if (payload) {
+ if (typeof payload.old_circ == 'object') {
+ foreign_circ = false;
+ my_circ = payload.old_circ;
+ }
+ }
+
+ if (foreign_circ) {
+ var my_copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[params.barcode]);
+ if (typeof my_copy.ilsevent != 'undefined') { throw(my_copy); }
+ my_circ = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),my_copy.id(),1]);
+ if (typeof my_circ.ilsevent != 'undefined') { throw(my_copy); }
+ my_circ = my_circ[0];
+ }
+
if (! stop_checkout ) {
- var r = obj.error.yns_alert(
- msg,
- document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
- document.getElementById('circStrings').getString('staff.circ.cancel'),
- document.getElementById('circStrings').getString('staff.circ.checkout.normal_checkin_then_checkout'),
- due_date ? (today > due_date ? document.getElementById('circStrings').getString('staff.circ.checkout.forgiving_checkin_then_checkout') : null) : null,
- document.getElementById('circStrings').getString('staff.circ.confirm.msg')
- );
- JSAN.use('circ.util');
- switch(r) {
- case 1:
- circ.util.checkin_via_barcode( ses(), { 'barcode' : params.barcode, 'noop' : 1 } );
- obj.checkout(params);
- break;
- case 2:
- circ.util.checkin_via_barcode( ses(), { 'barcode' : params.barcode, 'noop' : 1 }, due_date );
- obj.checkout(params);
- break;
- }
+
+ var due_date = my_circ.due_date() ? my_circ.due_date().substr(0,10) : null;
+ JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
+ if (due_date) {
+ if (today > due_date) {
+ msg += (document.getElementById('circStrings').getFormattedString('staff.circ.checkout.item_due', [due_date]) + '\n');
+ }
+ }
+
+ if (foreign_circ) { // OFFER CANCEL, NORMAL CHECKIN, AND POSSIBLY FORGIVING-BACKDATED CHECKIN
+ var r = obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.normal_checkin_then_checkout'),
+ due_date ? (today > due_date ? document.getElementById('circStrings').getString('staff.circ.checkout.forgiving_checkin_then_checkout') : null) : null,
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ JSAN.use('circ.util');
+ switch(r) {
+ case 1:
+ circ.util.checkin_via_barcode( ses(), { 'barcode' : params.barcode, 'noop' : 1 } );
+ obj.checkout(params);
+ break;
+ case 2:
+ circ.util.checkin_via_barcode( ses(), { 'barcode' : params.barcode, 'noop' : 1 }, due_date );
+ obj.checkout(params);
+ break;
+ }
+ } else { // EITHER AUTO-RENEW OR OFFER CANCEL, NORMAL CHECKIN, AND RENEW
+ if (payload.auto_renew) {
+ circ.util.renew_via_barcode( params.barcode, obj.patron_id, function(r) {
+ try {
+ params.renewal = true;
+ obj._checkout( params, r[0] );
+ } catch(E) {
+ alert('Error in checkout.js, RENEW 1: ' + E);
+ }
+ } );
+ } else {
+ var r = obj.error.yns_alert(
+ msg,
+ document.getElementById('circStrings').getString('staff.circ.checkout.barcode.check_out_failed'),
+ document.getElementById('circStrings').getString('staff.circ.cancel'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.normal_checkin_then_checkout'),
+ document.getElementById('circStrings').getString('staff.circ.checkout.offer_renewal'),
+ document.getElementById('circStrings').getString('staff.circ.confirm.msg')
+ );
+ JSAN.use('circ.util');
+ switch(r) {
+ case 1:
+ circ.util.checkin_via_barcode( ses(), { 'barcode' : params.barcode, 'noop' : 1 } );
+ obj.checkout(params);
+ break;
+ case 2:
+ circ.util.renew_via_barcode( params.barcode, obj.patron_id, function(r) {
+ try {
+ params.renewal = true;
+ obj._checkout( params, r[0] );
+ } catch(E) {
+ alert('Error in checkout.js, RENEW 2: ' + E);
+ }
+ } );
+ break;
+ }
+ }
+ }
} else {
obj.error.yns_alert(
msg,
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties 2009-09-22 03:54:02 UTC (rev 14081)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties 2009-09-22 05:21:59 UTC (rev 14082)
@@ -56,6 +56,7 @@
staff.circ.checkout.normal_checkin_then_checkout=Normal Checkin then Checkout
staff.circ.checkout.forgiving_checkin_then_checkout=Forgiving Checkin then Checkout
staff.circ.checkout.abort_transit_then_checkout=Abort Transit then Checkout
+staff.circ.checkout.offer_renewal=Renew Item
staff.circ.checkout.network_failure=There was a network failure.
staff.circ.checkout.copy_status=Copy status = %1$s
staff.circ.checkout.alert_message=Alert Message = %1$s
More information about the open-ils-commits
mailing list