[open-ils-commits] r8560 - branches/rel_1_2/Open-ILS/xul/staff_client/server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jan 31 18:05:15 EST 2008


Author: phasefx
Date: 2008-01-31 17:37:34 -0500 (Thu, 31 Jan 2008)
New Revision: 8560

Modified:
   branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js
Log:
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

Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js	2008-01-31 21:58:50 UTC (rev 8559)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/items.js	2008-01-31 22:37:34 UTC (rev 8560)
@@ -375,8 +375,16 @@
 				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 @@
 					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 @@
 					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 @@
 		);
 	},
 
-	'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);
 		}



More information about the open-ils-commits mailing list