patron.items.prototype = {
+ 'list_circ_map' : {},
+
'init' : function( params ) {
var obj = this;
'cmd_items_print2' : [ ['command'], function() { obj.items_print(2); } ],
'cmd_items_export' : [ ['command'], function() { obj.items_export(1); } ],
'cmd_items_export2' : [ ['command'], function() { obj.items_export(2); } ],
- 'cmd_items_renew' : [ ['command'], function() { obj.items_renew(1); /*alert('Action complete.'); obj.retrieve();*/ } ],
+ 'cmd_items_renew' : [ ['command'], function() { obj.items_renew(1); /* obj.retrieve();*/ } ],
'cmd_items_renew_all' : [ ['command'], function() { obj.items_renew_all(); } ],
- 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew(2); /*alert('Action complete.'); obj.retrieve();*/ } ],
- 'cmd_items_edit' : [ ['command'], function() { obj.items_edit(1); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_edit2' : [ ['command'], function() { obj.items_edit(2); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_mark_lost' : [ ['command'], function() { obj.items_mark_lost(1); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_mark_lost2' : [ ['command'], function() { obj.items_mark_lost(2); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_claimed_returned' : [ ['command'], function() { obj.items_claimed_returned(1); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_claimed_returned2' : [ ['command'], function() { obj.items_claimed_returned(2); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_checkin' : [ ['command'], function() { obj.items_checkin(1); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_items_checkin2' : [ ['command'], function() { obj.items_checkin(2); alert('Action complete.'); obj.retrieve(); } ],
+ 'cmd_items_renew2' : [ ['command'], function() { obj.items_renew(2); /* obj.retrieve();*/ } ],
+ 'cmd_items_edit' : [ ['command'], function() { obj.items_edit(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_edit2' : [ ['command'], function() { obj.items_edit(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_mark_lost' : [ ['command'], function() { obj.items_mark_lost(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_mark_lost2' : [ ['command'], function() { obj.items_mark_lost(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_claimed_returned' : [ ['command'], function() { obj.items_claimed_returned(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_claimed_returned2' : [ ['command'], function() { obj.items_claimed_returned(2); /*obj.retrieve();*/ } ],
+ 'cmd_items_checkin' : [ ['command'], function() { obj.items_checkin(1); /*obj.retrieve();*/ } ],
+ 'cmd_items_checkin2' : [ ['command'], function() { obj.items_checkin(2); /*obj.retrieve();*/ } ],
'cmd_show_catalog' : [ ['command'], function() { obj.show_catalog(1); } ],
'cmd_show_catalog2' : [ ['command'], function() { obj.show_catalog(2); } ],
- 'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); alert('Action complete.'); obj.retrieve(); } ],
- 'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); alert('Action complete.'); obj.retrieve(); } ],
+ 'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); /*obj.retrieve();*/ } ],
+ 'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); /*obj.retrieve();*/ } ],
'cmd_show_noncats' : [ ['command'], function() { obj.show_noncats(); } ],
}
}
try {
obj.list.select_all();
obj.items_renew(1,true);
- setTimeout(function(){list.on_all_fleshed = null; /*alert('Action complete.'); obj.retrieve();*/ },0);
+ setTimeout(function(){list.on_all_fleshed = null; /* obj.retrieve();*/ },0);
} catch(E) {
obj.error.standard_unexpected_error_alert('2 All items were not likely renewed',E);
}
var count = 0;
- function gen_renew(bc) {
+ function gen_renew(bc,circ_id) {
var x = document.getElementById('renew_msgs');
if (x) {
var l = document.createElement('label');
}
count--;
if (count == 0) {
- if (window.confirm('Action completed. Refresh list?')) obj.retrieve();
+ //if (window.confirm('Action completed. Refresh list?')) obj.retrieve();
JSAN.use('util.widgets'); util.widgets.remove_children(x);
}
+ obj.refresh(circ_id);
}
);
}
try {
count++;
var barcode = retrieve_ids[i].barcode;
- gen_renew(barcode);
-
+ var circ_id = retrieve_ids[i].circ_id;
+ gen_renew(barcode,circ_id);
} catch(E) {
obj.error.standard_unexpected_error_alert('Renew probably did not happen for barcode ' + barcode,E);
}
if (typeof robj.ilsevent != 'undefined') { if (robj.ilsevent != 0) throw(robj); }
}
}
+ for (var i = 0; i < obj.retrieve_ids.length; i++) {
+ obj.refresh(retrieve_ids[i].circ_id);
+ }
} catch(E) {
obj.error.standard_unexpected_error_alert('The due dates were not likely modified.',E);
}
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);
}
} catch(E) {
obj.error.standard_unexpected_error_alert('The items were not likely marked lost.',E);
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);
} catch(E) {
obj.error.standard_unexpected_error_alert('The items were not likely marked Claimed Returned.',E);
}
ses(), { 'copy_id' : copy_id }
);
/* circ.util.checkin_via_barcode handles errors currently */
+ obj.refresh(retrieve_ids[i].circ_id);
}
} catch(E) {
obj.error.standard_unexpected_error_alert('Checkin probably did not happen.',E);
);
},
+ 'refresh' : function(circ_id) {
+ 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;
+ }
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('Error refreshing row in list\ncirc_id = ' + circ_id + '\nnparams = ' + nparams,E);
+ }
+ },
+
'retrieve' : function(dont_show_me_the_list_change) {
var obj = this;
if (window.xulG && window.xulG.checkouts) {
function gen_list_append(circ_id,which_list) {
return function() {
try {
+ var nparams;
switch(which_list) {
case 1:
- obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true } );
+ nparams = obj.list2.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
break;
default:
- obj.list.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true } );
+ nparams = obj.list.append( { 'row' : { 'my' : { 'circ_id' : circ_id } }, 'to_bottom' : true, 'which_list' : which_list } );
break;
}
+ if (nparams) {
+ obj.list_circ_map[circ_id] = nparams; // unlike item status interface, each circ should be in this list only once
+ } else {
+ alert('foo');
+ }
} catch(E) {
alert(E);
}