From 165974ac3ffe185c7f5c4845849e313f036d54b3 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 21 Oct 2009 15:55:32 +0000 Subject: [PATCH] rework the parameters for circ.util.renew_via_barcode so that we can more easily pass in return_patron : true for the dedicated renewal interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@14535 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/circ/checkout.js | 4 +-- .../xul/staff_client/server/circ/copy_status.js | 2 +- Open-ILS/xul/staff_client/server/circ/renew.js | 3 +- Open-ILS/xul/staff_client/server/circ/util.js | 37 ++++++++++------------ Open-ILS/xul/staff_client/server/patron/items.js | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index 20100f3aac..e695a4de62 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -873,7 +873,7 @@ circ.checkout.prototype = { } } 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) { + circ.util.renew_via_barcode( { 'barcode': params.barcode, 'patron' : obj.patron_id }, function(r) { try { params.renewal = true; obj._checkout( params, r[0] ); @@ -897,7 +897,7 @@ circ.checkout.prototype = { obj.checkout(params); break; case 2: - circ.util.renew_via_barcode( params.barcode, obj.patron_id, function(r) { + circ.util.renew_via_barcode( { 'barcode' : params.barcode, 'patron' : obj.patron_id }, function(r) { try { params.renewal = true; obj._checkout( params, r[0] ); diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js index 53fc641d18..c7c7dd603e 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.js +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js @@ -268,7 +268,7 @@ circ.copy_status.prototype = { var test = obj.selection_list[i].renewable; var barcode = obj.selection_list[i].barcode; if (test == 't') { - circ.util.renew_via_barcode( barcode ); + circ.util.renew_via_barcode( { 'barcode' : barcode } ); funcs.push( function(a) { return function() { obj.copy_status( a, true ); }; }(barcode) ); } else { alert(document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.sel_renew.not_circulating', [barcode])); diff --git a/Open-ILS/xul/staff_client/server/circ/renew.js b/Open-ILS/xul/staff_client/server/circ/renew.js index cac53e289a..2d48dc9e3c 100644 --- a/Open-ILS/xul/staff_client/server/circ/renew.js +++ b/Open-ILS/xul/staff_client/server/circ/renew.js @@ -261,8 +261,7 @@ circ.renew.prototype = { if (auto_print) auto_print = auto_print.checked; JSAN.use('circ.util'); var renew = circ.util.renew_via_barcode( - barcode, - null, + { 'barcode' : barcode, 'return_patron' : true }, function( r ) { obj.renew_followup( r, barcode ); } diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 3f99b40b07..deee41d2d9 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -2877,15 +2877,12 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che } }; -circ.util.renew_via_barcode = function ( barcode, patron_id, async ) { +circ.util.renew_via_barcode = function ( params, async ) { try { var obj = {}; JSAN.use('util.network'); obj.network = new util.network(); JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.stash_retrieve(); - var params = { barcode: barcode }; - if (patron_id) params.patron = patron_id; - function renew_callback(req) { try { JSAN.use('util.error'); var error = new util.error(); @@ -2938,7 +2935,7 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) { return renew; } catch(E) { JSAN.use('util.error'); var error = new util.error(); - error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [barcode]), E); + error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E); return null; } } @@ -2968,31 +2965,31 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) { 7013 /* PATRON_EXCEEDS_FINES */, ], 'text' : { - '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, + '1212' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '1213' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '1215' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, '1232' : function(r) { - return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_deposit_required.warning.barcode', [barcode]); + return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_deposit_required.warning.barcode', [params.barcode]); }, '1233' : function(r) { - return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_rental_fee_required.warning.barcode', [barcode]); + return document.getElementById('circStrings').getFormattedString('staff.circ.renew.override.item_rental_fee_required.warning.barcode', [params.barcode]); }, '1234' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.utils.checkin.override.item_deposit_paid.warning'); }, - '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, + '7002' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '7003' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, '7004' : function(r) { - return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]); + return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.status', [params.barcode, typeof r.payload.status() == 'object' ? r.payload.status().name() : obj.data.hash.ccs[ r.payload.status() ].name()]); }, - '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, - '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); }, + '7006' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '7007' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '7008' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, + '7009' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); }, '7010' : function(r) { - return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [barcode, r.payload]); + return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode.msg', [params.barcode, r.payload]); }, - '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [barcode]); } + '7013' : function(r) { return document.getElementById('circStrings').getFormattedString('staff.circ.renew.barcode', [params.barcode]); } } } ); @@ -3002,7 +2999,7 @@ circ.util.renew_via_barcode = function ( barcode, patron_id, async ) { } catch(E) { JSAN.use('util.error'); var error = new util.error(); - error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [barcode]), E); + error.standard_unexpected_error_alert(document.getElementById('circStrings').getFormattedString('staff.circ.checkin.renew_failed.error', [params.barcode]), E); return null; } }; diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js index 2f282c3431..9e6d21a6ce 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.js +++ b/Open-ILS/xul/staff_client/server/patron/items.js @@ -275,7 +275,7 @@ patron.items.prototype = { l.setAttribute('value', $("patronStrings").getFormattedString('staff.patron.items.items_renew.renewing',[bc])); x.appendChild(l); } - var renew = circ.util.renew_via_barcode( bc, obj.patron_id, + var renew = circ.util.renew_via_barcode( { 'barcode' : bc, 'patron' : obj.patron_id }, function(r) { try { if ( (typeof r[0].ilsevent != 'undefined' && r[0].ilsevent == 0) ) { -- 2.11.0