From: phasefx Date: Thu, 22 Oct 2009 06:41:29 +0000 (+0000) Subject: For backdating-already-returned-items prompt, don't display circ summaries for each... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=474e9c43afe7cab4d0067c6306062bcb9645b982;p=evergreen%2Fbjwebb.git For backdating-already-returned-items prompt, don't display circ summaries for each circ, and use streaming version of batch backdate method git-svn-id: svn://svn.open-ils.org/ILS/trunk@14551 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 b7f774581..aa34d76ef 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -191,7 +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_CIRC_BACKDATE_BATCH' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.post_checkin_backdate.batch' }, '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 cf40bb139..3c255f98a 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 @@ -1,4 +1,4 @@ -var data; var error; +var data; var error; var network; var sound; function $(id) { return document.getElementById(id); } @@ -23,20 +23,19 @@ function backdate_post_checkin_init() { JSAN.use('util.error'); error = new util.error(); - JSAN.use('util.date'); + JSAN.use('util.network'); network = new util.network(); + + JSAN.use('util.sound'); sound = new util.sound(); + + JSAN.use('util.date'); + + dojo.require('openils.Util'); $('checkin_effective_datepicker').value = util.date.formatted_date(new Date(),'%F'); 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 }; - } - ); + if (x) x.appendChild( document.createTextNode( $('circStrings').getFormattedString('staff.circ.backdate.circ_ids.prompt',[circ_ids.length,circ_ids.join(',')]) ) ); /* set widget behavior */ $('cancel_btn').addEventListener( @@ -44,15 +43,7 @@ function backdate_post_checkin_init() { ); $('apply_btn').addEventListener( 'command', - function() { - update_modal_xulG( - { - 'backdate' : $('checkin_effective_datepicker').value, - 'proceed' : 1 - } - ) - window.close(); - }, + gen_handle_apply(circ_ids), false ); @@ -87,3 +78,48 @@ function backdate_post_checkin_init() { } +function gen_handle_apply(circ_ids) { + return function handle_apply(ev) { + try { + var backdate = $('checkin_effective_datepicker').value; + var progressmeter = $('progress'); + + var idx = -1; + var bad_circs = []; + + fieldmapper.standardRequest( + [ api.FM_CIRC_BACKDATE_BATCH.app, api.FM_CIRC_BACKDATE_BATCH.method ], + { async: true, + params: [ses(), circ_ids, backdate], + onresponse: function(r) { + idx++; progressmeter.value = Number( progressmeter.value ) + 100/circ_ids.length; + var result = r.recv().content(); + if (result != 1) { + bad_circs.push( { 'circ_id' : circ_ids[ idx ], 'result' : result } ); + } + }, + oncomplete: function() { + if (bad_circs.length > 0) { + sound.circ_bad(); + alert( $('circStrings').getFormattedString('staff.circ.backdate.circ_ids.failed',[ bad_circs.length, bad_circs.join(',') ]) ); + } else { + sound.circ_good(); + } + + update_modal_xulG( + { + 'backdate' : backdate, + 'bad_circs' : bad_circs, + 'complete' : 1 + } + ) + window.close(); + } + } + ); + + } catch(E) { + alert('Error in backdate.js, handle_apply(): ' + E); + } + }; +} 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 103dd22c5..425f937b3 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 @@ -20,7 +20,7 @@ @@ -37,6 +37,7 @@ +