From 89420eb104cdecd3b9c05e9f96f3269715b56fbd Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 21 Oct 2009 08:12:16 +0000 Subject: [PATCH] use batch api call for post-checkin backdating git-svn-id: svn://svn.open-ils.org/ILS/trunk@14513 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/chrome/content/main/constants.js | 1 + .../staff_client/server/circ/backdate_post_checkin.js | 12 ++++++++++-- .../staff_client/server/circ/backdate_post_checkin.xul | 2 +- Open-ILS/xul/staff_client/server/circ/checkin.js | 4 +++- Open-ILS/xul/staff_client/server/circ/util.js | 18 +++++++++++------- 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 8c5f85fba4..b7f7745818 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -191,6 +191,7 @@ const api = { 'FM_CIRC_IMPROVED_COUNT_VIA_COPY' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.circbyyr.atomic' }, 'FM_CIRC_EDIT_DUE_DATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.circulation.due_date.update' }, 'FM_CIRC_BACKDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate' }, + 'FM_CIRC_BACKDATE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate.batch.atomic' }, 'FM_CIT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.ident_types.retrieve', 'secure' : false }, 'FM_CITM_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.item_type_map.retrieve.all', 'secure' : false }, 'FM_CNAL_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.net_access_level.retrieve.all', 'secure' : false }, diff --git a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js index aab214c49d..cf40bb1399 100644 --- a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.js @@ -27,8 +27,16 @@ function backdate_post_checkin_init() { $('checkin_effective_datepicker').value = util.date.formatted_date(new Date(),'%F'); - $('circ_brief').setAttribute('src', urls.XUL_CIRC_BRIEF); - get_contentWindow($('circ_brief')).xulG = { 'circ_id' : xul_param('circ_id',{'modal_xulG':true}) }; + var x = $('circ_brief_area'); + var circ_ids = xul_param('circ_ids',{'modal_xulG':true}); + dojo.forEach( + circ_ids, + function(element,idx,list) { + var iframe = document.createElement('iframe'); x.appendChild(iframe); + iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); + get_contentWindow(iframe).xulG = { 'circ_id' : element }; + } + ); /* set widget behavior */ $('cancel_btn').addEventListener( diff --git a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul index ffed058da0..103dd22c50 100644 --- a/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul +++ b/Open-ILS/xul/staff_client/server/circ/backdate_post_checkin.xul @@ -36,7 +36,7 @@ <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// --> <!-- CONTENT --> <dialogheader title="&staff.circ.backdate_post_checkin.header;" description="&staff.circ.backdate_post_checkin.description;" /> - <iframe id="circ_brief" flex="1"/> + <vbox class="my_overflow" id="circ_brief_area" flex="1"/> <hbox> <label id="checkin_effective_date_label" value="&staff.circ.checkin_overlay.effective_date.label;" control="checkin_effective_datepicker" accesskey="&staff.circ.checkin_overlay.effective_date.accesskey;"/> <datepicker id="checkin_effective_datepicker" type="popup" context="clipboard"/> diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js index 019455701c..6acee6d437 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkin.js +++ b/Open-ILS/xul/staff_client/server/circ/checkin.js @@ -169,6 +169,7 @@ circ.checkin.prototype = { ['command'], function() { JSAN.use('circ.util'); + var circ_ids = []; for (var i = 0; i < obj.selection_list.length; i++) { var circ_id = obj.selection_list[i].circ_id; var copy_id = obj.selection_list[i].copy_id; @@ -177,8 +178,9 @@ circ.checkin.prototype = { if (blob.circ) circ_id = blob.circ.id(); } if (!circ_id) continue; - circ.util.backdate_post_checkin( circ_id ); + circ_ids.push( circ_id ); } + circ.util.backdate_post_checkin( circ_ids ); } ], 'sel_mark_items_damaged' : [ diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index b7d8f4355a..db5dd67caf 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -84,7 +84,7 @@ circ.util.show_copy_details = function(copy_id) { } }; -circ.util.backdate_post_checkin = function(circ_id) { +circ.util.backdate_post_checkin = function(circ_ids) { var obj = {}; JSAN.use('util.error'); obj.error = new util.error(); JSAN.use('util.window'); obj.win = new util.window(); @@ -94,29 +94,33 @@ circ.util.backdate_post_checkin = function(circ_id) { var circStrings = document.getElementById('circStrings'); - if (typeof circ_id == 'object' && circ_id != null) circ_id = circ_id.id(); + dojo.forEach( + circ_ids, + function(element,idx,list) { + if (typeof element == 'object' && element != null) list[idx] = element.id(); + } + ); try { var url = xulG.url_prefix( urls.XUL_BACKDATE ); - obj.data.temp_circ_id = circ_id; obj.data.stash('temp_circ_id'); - var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', {} ); + var my_xulG = obj.win.open( url, 'backdate_post_checkin', 'chrome,resizable,modal', { 'circ_ids' : circ_ids } ); if (typeof my_xulG.proceed == 'undefined') return; - var r = obj.network.simple_request( 'FM_CIRC_BACKDATE', [ ses(), circ_id, my_xulG.backdate ] ); + var r = obj.network.simple_request( 'FM_CIRC_BACKDATE_BATCH', [ ses(), circ_ids, my_xulG.backdate ] ); if (r == 1) { obj.sound.circ_good(); var x = $('no_change_label'); if (x) { x.hidden = false; - x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.success',[circ_id,my_xulG.backdate])); + x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.success',[circ_ids.join(","),my_xulG.backdate])); } } else { obj.sound.circ_bad(); var x = $('no_change_label'); if (x) { x.hidden = false; - x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.failed',[circ_id,r.textcode])); + x.setAttribute('value', circStrings.getFormattedString('staff.circ.backdate.failed',[circ_ids.join(","),r.textcode])); } } -- 2.11.0