if (edit==0) return; // no read-only view for this interface
- var title = 'Add Copy';
+ var title = 'Add Item';
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
return; // no read-only view for this interface
}
- var title = 'Add Volume/Copy';
+ var title = 'Add Volume/Item';
JSAN.use('util.window'); var win = new util.window();
var w = win.open(
if (list.length == 1) {
obj.data.marked_volume = list[0];
obj.data.stash('marked_volume');
- alert('Volume marked as Copy Transfer Destination');
+ alert('Volume marked as Item Transfer Destination');
} else {
- obj.error.yns_alert('Choose just one Volume to mark as Copy Transfer Destination','Limit Selection','OK',null,null,'Check here to confirm this dialog');
+ obj.error.yns_alert('Choose just one Volume to mark as Item Transfer Destination','Limit Selection','OK',null,null,'Check here to confirm this dialog');
}
} catch(E) {
obj.error.standard_unexpected_error_alert('copy browser -> mark volume',E);
try {
obj.data.stash_retrieve();
if (!obj.data.marked_library) {
- alert('Please mark a library as the destination from within the copy browser and then try this again.');
+ alert('Please mark a library as the destination from within holdings maintenance and then try this again.');
return;
}
}
} catch(E) {
- obj.error.standard_unexpected_error_alert('Volumes not likely transferred.',E);
+ obj.error.standard_unexpected_error_alert('All volumes not likely transferred.',E);
+ }
+ obj.refresh_list();
+ }
+ ],
+
+ 'cmd_transfer_items' : [
+ ['command'],
+ function() {
+ try {
+ obj.data.stash_retrieve();
+ if (!obj.data.marked_volume) {
+ alert('Please mark a volume as the destination from within holdings maintenance and then try this again.');
+ return;
+ }
+
+ JSAN.use('util.functional');
+
+ var list = util.functional.filter_list(
+ obj.sel_list,
+ function (o) {
+ return o.split(/_/)[0] == 'acp';
+ }
+ );
+
+ list = util.functional.map_list(
+ list,
+ function (o) {
+ return o.split(/_/)[1];
+ }
+ );
+
+ var volume = obj.network.simple_request('FM_ACN_RETRIEVE',[ obj.data.marked_volume ]);
+
+ JSAN.use('cat.util'); cat.util.transfer_copies( {
+ 'copy_ids' : list,
+ 'docid' : volume.record(),
+ 'volume_label' : volume.label(),
+ 'owning_lib' : volume.owning_lib(),
+ } );
+
+ } catch(E) {
+ obj.error.standard_unexpected_error_alert('All copies not likely transferred.',E);
}
obj.refresh_list();
}
obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
+ obj.controller.view.cmd_transfer_items.setAttribute('disabled','true');
if (found_aou) {
obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
obj.controller.view.cmd_edit_items.setAttribute('disabled','false');
obj.controller.view.cmd_delete_items.setAttribute('disabled','false');
obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','false');
+ obj.controller.view.cmd_transfer_items.setAttribute('disabled','false');
}
} catch(E) {
obj.error.standard_unexpected_error_alert('Copy Browser Actions',E);
<command id="cmd_add_items_to_buckets"/>
<command id="cmd_edit_items"/>
<command id="cmd_delete_items"/>
+ <command id="cmd_transfer_items"/>
<command id="cmd_print_spine_labels"/>
<command id="cmd_add_volumes"/>
<command id="cmd_edit_volumes"/>
<menuitem command="cmd_add_items_to_buckets" label="Add Items to Buckets" accesskey="A"/>
<menuitem command="cmd_edit_items" label="Edit Item Attributes" accesskey="E"/>
<menuitem command="cmd_delete_items" label="Delete Items" accesskey=""/>
+ <menuitem command="cmd_transfer_items" label="Transfer Items to Previously Marked Volume" accesskey="T"/>
<menuitem command="cmd_print_spine_labels" label="Print Item Spine Labels" accesskey="P"/>
<menuseparator/>
<menuitem command="cmd_add_volumes" label="Add Volumes" accesskey="V"/>
<menuitem command="cmd_edit_volumes" label="Edit Volumes" accesskey=""/>
<menuitem command="cmd_delete_volumes" label="Delete Volumes" accesskey=""/>
<menuitem command="cmd_mark_volume" label="Mark Volume as Item Transfer Destination" accesskey="M"/>
- <menuitem command="cmd_transfer_volume" label="Transfer Volume to Previously Marked Library" accesskey=""/>
+ <menuitem command="cmd_transfer_volume" label="Transfer Volumes to Previously Marked Library" accesskey=""/>
<menuseparator/>
<menuitem command="cmd_refresh_list" label="Refresh Listing" accesskey="R"/>
</popup>
<hbox>
<!--<button label="Clear" command="cmd_clear" accesskey="C"/>-->
<!-- <button label="Show My Libs" command="cmd_show_my_libs" accesskey="M"/>-->
- <button label="Show Libs With Copies" command="cmd_show_libs_with_copies" accesskey="L"/>
+ <button label="Show Libs With Items" command="cmd_show_libs_with_copies" accesskey="L"/>
<button label="Show All Libs" command="cmd_show_all_libs" accesskey=""/>
<spacer flex="1"/>
<menubar>
<menuitem command="cmd_add_items_to_buckets" label="Add Items to Buckets" accesskey="A"/>
<menuitem command="cmd_edit_items" label="Edit Item Attributes" accesskey="E"/>
<menuitem command="cmd_delete_items" label="Delete Items" accesskey=""/>
+ <menuitem command="cmd_transfer_items" label="Transfer Items to Previously Marked Volume" accesskey="T"/>
<menuitem command="cmd_print_spine_labels" label="Print Item Spine Labels" accesskey="P"/>
<menuseparator/>
<menuitem command="cmd_add_volumes" label="Add Volumes" accesskey="V"/>
<menuitem command="cmd_edit_volumes" label="Edit Volumes" accesskey=""/>
<menuitem command="cmd_delete_volumes" label="Delete Volumes" accesskey=""/>
<menuitem command="cmd_mark_volume" label="Mark Volume as Item Transfer Destination" accesskey="M"/>
- <menuitem command="cmd_transfer_volume" label="Transfer Volume to Previously Marked Library" accesskey=""/>
+ <menuitem command="cmd_transfer_volume" label="Transfer Volumes to Previously Marked Library" accesskey=""/>
<menuseparator/>
<menuitem command="cmd_refresh_list" label="Refresh Listing" accesskey="R"/>
</menupopup>
try {
obj.list2.select_all();
- // FM_ACN_RETRIEVE
obj.data.stash_retrieve();
if (!obj.data.marked_volume) {
alert('Please mark a volume as the destination from within the copy browser and then try this again.');
return;
}
- var volume = obj.network.simple_request('FM_ACN_RETRIEVE',[ obj.data.marked_volume ]);
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
- var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
- xml += '<description>Transfer the copies in bucket "';
- xml += obj.controller.view.bucket_menulist.getAttribute('label') + '" ';
- xml += 'from their original volumes to ';
- xml += obj.data.hash.aou[ volume.owning_lib() ].shortname() + "'s volume labelled ";
- xml += '"' + volume.label() + '" on the following record?</description>';
- xml += '<hbox><button label="Transfer" name="fancy_submit"/>';
- xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
- xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + volume.record() + '"/>';
- xml += '</vbox>';
- obj.data.temp_transfer = xml; obj.data.stash('temp_transfer');
- window.open(
- urls.XUL_FANCY_PROMPT
- + '?xml_in_stash=temp_transfer'
- + '&title=' + window.escape('Copy Transfer'),
- 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
- );
- JSAN.use('OpenILS.data');
- var data = new OpenILS.data(); data.init({'via':'stash'});
- if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
- JSAN.use('util.functional');
+ var copy_ids = util.functional.map_list(
+ obj.list2.dump_retrieve_ids(),
+ function (o) {
+ return JSON2js(o)[0]; // acp_id
+ }
+ )
- var copies = obj.network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE', [
- util.functional.map_list(
- obj.list2.dump_retrieve_ids(),
- function (o) {
- return JSON2js(o)[0]; // acp_id
- }
- )
- ]);
+ var volume = obj.network.simple_request('FM_ACN_RETRIEVE',[ obj.data.marked_volume ]);
- for (var i = 0; i < copies.length; i++) {
- copies[i].call_number( obj.data.marked_volume );
- copies[i].ischanged( 1 );
- }
+ var msg = 'Transfer the items in bucket "';
+ msg += obj.controller.view.bucket_menulist.getAttribute('label') + '" ';
+ msg += 'from their original volumes to ';
+ msg += obj.data.hash.aou[ volume.owning_lib() ].shortname() + "'s volume labelled ";
+ msg += '"' + volume.label() + '" on the following record?';
- var robj = obj.network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), copies, true ]);
+ JSAN.use('cat.util'); cat.util.transfer_copies( {
+ 'copy_ids' : copy_ids,
+ 'message' : msg,
+ 'docid' : volume.record(),
+ 'volume_label' : volume.label(),
+ 'owning_lib' : volume.owning_lib(),
+ } );
obj.render_pending_copies(); // FIXME -- need a generic refresh for lists
setTimeout(
}, 0
);
- if (typeof robj.ilsevent != 'undefined') {
- throw(robj);
- } else {
- alert('Copies transferred.');
- }
-
} catch(E) {
- obj.error.standard_unexpected_error_alert('Copies not likely transferred.',E);
+ obj.error.standard_unexpected_error_alert('Items not likely transferred.',E);
}
}
],
cat.util = {};
cat.util.EXPORT_OK = [
- 'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor',
+ 'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor', 'transfer_copies',
];
cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
+cat.util.transfer_copies = function(params) {
+ JSAN.use('util.error'); var error = new util.error();
+ JSAN.use('OpenILS.data'); var data = new OpenILS.data();
+ JSAN.use('util.network'); var network = new util.network();
+ try {
+ data.stash_retrieve();
+ if (!data.marked_volume) {
+ alert('Please mark a volume as the destination from within holdings maintenance and then try this again.');
+ return;
+ }
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+ var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
+ if (!params.message) {
+ params.message = 'Transfer items from their original volumes to ';
+ params.message += data.hash.aou[ params.owning_lib ].shortname() + "'s volume labelled ";
+ params.message += '"' + params.volume_label + '" on the following record?';
+ }
+
+ xml += '<description>' + params.message + '</description>';
+ xml += '<hbox><button label="Transfer" name="fancy_submit"/>';
+ xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
+ xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + params.docid + '"/>';
+ xml += '</vbox>';
+ data.temp_transfer = xml; data.stash('temp_transfer');
+ window.open(
+ urls.XUL_FANCY_PROMPT
+ + '?xml_in_stash=temp_transfer'
+ + '&title=' + window.escape('Item Transfer'),
+ 'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+ );
+ data.stash_retrieve();
+ if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+
+ JSAN.use('util.functional');
+
+ var copies = network.simple_request('FM_ACP_FLESHED_BATCH_RETRIEVE', [ params.copy_ids ]);
+
+ for (var i = 0; i < copies.length; i++) {
+ copies[i].call_number( data.marked_volume );
+ copies[i].ischanged( 1 );
+ }
+
+ var robj = network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE', [ ses(), copies, true ]);
+
+ if (typeof robj.ilsevent != 'undefined') {
+ throw(robj);
+ } else {
+ alert('Items transferred.');
+ }
+
+ } catch(E) {
+ error.standard_unexpected_error_alert('All items not likely transferred.',E);
+ }
+}
+
cat.util.spawn_spine_editor = function(selection_list) {
JSAN.use('util.error'); var error = new util.error();
try {