'sel_opac' : [ ['command'], function() { JSAN.use('cat.util'); cat.util.show_in_opac(obj.selection_list); } ],
'sel_transit_abort' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.abort_transits(obj.selection_list); } ],
'sel_patron' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.selection_list); } ],
- 'sel_copy_details' : [ ['command'], function() { JSAN.use('circ.util'); for (var i = 0; i < obj.selection_list.length; i++) { circ.util.show_copy_details( obj.selection_list[i].copy_id ); } } ],
+ 'sel_copy_details' : [ ['command'],
+ function() {
+ JSAN.use('circ.util');
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
+ } ],
'sel_bucket' : [ ['command'], function() { JSAN.use('cat.util'); cat.util.add_copies_to_bucket(obj.selection_list); } ],
'cmd_print_list' : [ ['command'], function() { obj.print_list(0); } ],
'cmd_kick_off' : [ ['command'], function(ev) { ev.target.disabled = true; obj.kick_off(); } ],
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_backdate' : [
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_renew' : [
var f = obj.browser.get_content();
xulG.barcode = result.copy.barcode(); // FIXME: We could pass the already-fetched data, but need to figure out how to manage that and honor Trim List, the whole point of which is to limit memory consumption
if (f) {
- f.xulG = xulG;
- f.load_item();
+ if (!xulG.from_item_details_new) {
+ /* We don't want to call load_item() in this case
+ * because we're going to call copy_status() later
+ * (which gets action menus populated, unlike
+ * load_item()). */
+ f.xulG = xulG;
+ f.load_item();
+ }
} else {
alert('hrmm');
}
}
}
- JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
-
- g.barcodes = xul_param(
- 'barcodes',{
- 'concat' : true,
- 'JSON2js_if_cgi' : true,
- 'stash_name':'temp_barcodes_for_copy_status',
- 'clear_xpcom' : true,
+ JSAN.use('OpenILS.data');
+ g.data = new OpenILS.data();
+ g.data.stash_retrieve();
+
+ if (window.xulG.barcodes && window.xulG.barcodes.length) {
+ if (window.xulG.from_item_details_new) {
+ // Switch item status display to "alternate view"
+ g.copy_status.controller.control_map.cmd_alt_view[1](0);
+
+ // This property's truthiness should not persist any
+ // longer. Otherwise, user's won't get results if they
+ // enter a different barcode into the Alternate View.
+ window.xulG.from_item_details_new = false;
}
- ) || [];
-
- if (g.barcodes.length > 0) {
+
+ // This timeout is needed to populate the
+ // "Actions for (Catalogers|Selected Items)" menus.
+ // Without this, the other fields still get populated
+ // with data about the item referred to by barcode, but
+ // for some reason those menus don't start working.
JSAN.use('util.exec'); var exec = new util.exec();
var funcs = [];
- for (var i = 0; i < g.barcodes.length; i++) {
+ for (var i = 0; i < window.xulG.barcodes.length; i++) {
funcs.push(
function(b){
return function() {
g.copy_status.copy_status(b);
}
- }(g.barcodes[i])
+ }(window.xulG.barcodes[i])
);
}
- exec.chain( funcs );
+ setTimeout(function() { exec.chain(funcs); }, 1000);
+ } else {
+ g.barcodes = xul_param(
+ 'barcodes',{
+ 'concat' : true,
+ 'JSON2js_if_cgi' : true,
+ 'stash_name':'temp_barcodes_for_copy_status',
+ 'clear_xpcom' : true,
+ }
+ ) || [];
+
+ if (g.barcodes.length > 0) {
+ JSAN.use('util.exec'); var exec = new util.exec();
+ var funcs = [];
+ for (var i = 0; i < g.barcodes.length; i++) {
+ funcs.push(
+ function(b){
+ return function() {
+ g.copy_status.copy_status(b);
+ }
+ }(g.barcodes[i])
+ );
+ }
+ if (window.xulG.from_item_details_new) {
+ g.copy_status.controller.control_map.cmd_alt_view[1](0);
+ window.xulG.from_item_details_new = false;
+ }
+ setTimeout(function() { exec.chain(funcs); }, 1000);
+ }
}
-
} catch(E) {
var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['circ.copy_status.xul', E]);
try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.selection_list.length; i++) {
- circ.util.show_copy_details( obj.selection_list[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.selection_list,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_mark_items_damaged' : [
}
};
+circ.util.item_details_new = function(barcodes) {
+ try {
+ var content_params = {
+ 'from_item_details_new': true,
+ 'barcodes': barcodes
+ };
+ xulG.new_tab(urls.XUL_COPY_STATUS, {}, content_params);
+ } catch(E) {
+ JSAN.use('util.error');
+ (new util.error()).standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.utils.retrieve_copy.failure'),E);
+ }
+};
+
circ.util.backdate_post_checkin = function(circ_ids) {
var obj = {};
JSAN.use('util.error'); obj.error = new util.error();
['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) {
- if (obj.retrieve_ids[i].copy_id) circ.util.show_copy_details( obj.retrieve_ids[i].copy_id );
- }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.retrieve_ids,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_copy_details' : [ ['command'],
function() {
JSAN.use('circ.util');
- for (var i = 0; i < obj.retrieve_ids.length; i++) { circ.util.show_copy_details( obj.retrieve_ids[i].copy_id ); }
+ circ.util.item_details_new(
+ util.functional.map_list(
+ obj.retrieve_ids,
+ function(o) { return o.barcode; }
+ )
+ );
}
],
'sel_patron2' : [ ['command'], function() { JSAN.use('circ.util'); circ.util.show_last_few_circs(obj.retrieve_ids2); } ],