From a01d45fd07677b49162ae77f2d4eaa91f23c56e5 Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 1 Feb 2008 17:25:05 +0000 Subject: [PATCH] single-row refresh does not realize when an item needs to move between lists, as in the Item Outs interface with Mark Lost or Claimed Returned. This is a quick fix, needs testing git-svn-id: svn://svn.open-ils.org/ILS/trunk@8570 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/items.js | 42 ++++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js index deef6ec20c..f8f2a5b1bd 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.js +++ b/Open-ILS/xul/staff_client/server/patron/items.js @@ -375,8 +375,16 @@ patron.items.prototype = { var barcode = retrieve_ids[i].barcode; dump('Mark barcode lost = ' + barcode); var robj = obj.network.simple_request( 'MARK_ITEM_LOST', [ ses(), { barcode: barcode } ]); - if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); } - obj.refresh(retrieve_ids[i].circ_id); + if (typeof robj.ilsevent != 'undefined') { + switch(robj.ilsevent) { + case 7018 /* COPY_MARKED_LOST */ : + alert( 'Item Barcode ' + barcode + '\n' + robj.desc ); + break; + default: throw(robj); + } + } else { + obj.refresh(retrieve_ids[i].circ_id,true); + } } } catch(E) { obj.error.standard_unexpected_error_alert('The items were not likely marked lost.',E); @@ -433,7 +441,7 @@ patron.items.prototype = { if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); } } } - for (var i = 0; i < retrieve_ids.length; i++) obj.refresh(retrieve_ids[i].circ_id); + for (var i = 0; i < retrieve_ids.length; i++) obj.refresh(retrieve_ids[i].circ_id,true); } catch(E) { obj.error.standard_unexpected_error_alert('The items were not likely marked Claimed Returned.',E); } @@ -456,8 +464,8 @@ patron.items.prototype = { ses(), { 'copy_id' : copy_id } ); /* circ.util.checkin_via_barcode handles errors currently */ - obj.refresh(retrieve_ids[i].circ_id); } + obj.retrieve(); } catch(E) { obj.error.standard_unexpected_error_alert('Checkin probably did not happen.',E); } @@ -660,19 +668,25 @@ patron.items.prototype = { ); }, - 'refresh' : function(circ_id) { + 'refresh' : function(circ_id,move_to_bottom_list) { var obj = this; try { var nparams = obj.list_circ_map[circ_id]; - var which_list = nparams.which_list; - switch(which_list) { - case 1: case '1': - setTimeout(function(){try{obj.list2.refresh_row(nparams);}catch(E){obj.error.standard_unexpected_error_alert('2 Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E);}},1000); - break; - default: - setTimeout(function(){try{obj.list.refresh_row(nparams);}catch(E){obj.error.standard_unexpected_error_alert('2 Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E);}},1000); - break; - } + if (move_to_bottom_list) { + obj.list_circ_map[circ_id].my_node.setAttribute('hidden','true'); + var nparams2 = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : 1 } ); + obj.list_circ_map[circ_id] = nparams2; + } else { + var which_list = nparams.which_list; + switch(which_list) { + case 1: case '1': + setTimeout(function(){try{obj.list2.refresh_row(nparams);}catch(E){obj.error.standard_unexpected_error_alert('2 Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E);}},1000); + break; + default: + setTimeout(function(){try{obj.list.refresh_row(nparams);}catch(E){obj.error.standard_unexpected_error_alert('2 Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E);}},1000); + break; + } + } } catch(E) { obj.error.standard_unexpected_error_alert('Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E); } -- 2.11.0