single-row refresh does not realize when an item needs to move between lists, as...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jan 2008 22:40:26 +0000 (22:40 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jan 2008 22:40:26 +0000 (22:40 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2_1@8561 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/items.js

index 6e8da28..7d70fb7 100644 (file)
@@ -402,8 +402,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);
@@ -460,7 +468,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);
                }
@@ -483,8 +491,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);
                }
@@ -687,19 +695,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);
                }