From 4f7c00cf8574d6485e74e817197f8687a8a547b2 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 7 Apr 2011 16:42:28 -0400 Subject: [PATCH] Holdings Maintenance: Actions for Selected Rows -> Link as Multi-Bib Items to Previously Marked Bib Record --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../xul/staff_client/server/cat/copy_browser.js | 39 ++++++++++++++++ .../xul/staff_client/server/cat/copy_browser.xul | 3 ++ .../server/cat/manage_multi_home_items.js | 54 +++++++++++++++++++--- .../server/locale/en-US/cat.properties | 1 + 5 files changed, 93 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 6f5b96168a..a28372f332 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2489,6 +2489,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.js b/Open-ILS/xul/staff_client/server/cat/copy_browser.js index e962dfd19a..4e7fcf77bb 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.js @@ -871,6 +871,45 @@ cat.copy_browser.prototype = { obj.refresh_list(); } ], + + 'cmd_link_as_multi_bib' : [ + ['command'], + function() { + try { + obj.data.stash_retrieve(); + if (!obj.data.marked_multi_home_record) { + alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.link_as_multi_bib.missing_bib')); + 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 obj.map_acp[ o ].barcode(); + } + ); + + xulG.new_tab( + window.xulG.url_prefix(urls.MANAGE_MULTI_HOME_ITEMS), + {}, + { 'docid' : obj.data.marked_multi_home_record, 'barcodes' : list } + ); + + } catch(E) { + alert('Error in copy_browser.js, cmd_link_as_multi_bib: ' + E); + } + obj.refresh_list(); + } + ] } } ); diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul index 319ae35480..240fceba2a 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul @@ -88,6 +88,7 @@ vim:noet:sw=4:ts=4: + @@ -111,6 +112,7 @@ vim:noet:sw=4:ts=4: + @@ -164,6 +166,7 @@ vim:noet:sw=4:ts=4: + diff --git a/Open-ILS/xul/staff_client/server/cat/manage_multi_home_items.js b/Open-ILS/xul/staff_client/server/cat/manage_multi_home_items.js index 656019ffca..96112d1a32 100644 --- a/Open-ILS/xul/staff_client/server/cat/manage_multi_home_items.js +++ b/Open-ILS/xul/staff_client/server/cat/manage_multi_home_items.js @@ -1,4 +1,4 @@ -var data; var list; var error; var net; var pcrud; var sound; +var data; var list; var error; var net; var sound; var rows = {}; var bpbcm_barcode_map = {}; @@ -34,7 +34,6 @@ function my_init() { data.stash_retrieve(); JSAN.use('util.network'); net = new util.network(); dojo.require('openils.PermaCrud'); - pcrud = new openils.PermaCrud( { authtoken :ses() }); JSAN.use('cat.util'); init_menu(); @@ -147,13 +146,17 @@ function handle_keypress(ev) { } } -function handle_submit(create,my_bpbcm) { +function handle_submit(create,my_bpbcm,my_barcode) { try { var barcode; if (create) { - barcode = $('scanbox').value; - $('scanbox').value = ''; - default_focus(); + if (my_barcode) { + barcode = my_barcode; + } else { + barcode = $('scanbox').value; + $('scanbox').value = ''; + default_focus(); + } } var placeholder_acp = new acp(); @@ -200,6 +203,7 @@ function handle_submit(create,my_bpbcm) { new_bpbcm.peer_type($('bpt_menu').value); new_bpbcm.peer_record(xul_param('docid')); new_bpbcm.target_copy(robj.copy.id()); + var pcrud = new openils.PermaCrud( { authtoken :ses() }); pcrud.create(new_bpbcm, { "onerror" : function(r) { dump('onerror, r = ' + js2JSON(r) + '\n'); @@ -256,6 +260,7 @@ function handle_submit(create,my_bpbcm) { function populate_list() { try { + var pcrud = new openils.PermaCrud( { authtoken :ses() }); pcrud.search( 'bpbcm', { @@ -268,6 +273,9 @@ function populate_list() { alert('Error in manage_multi_home_items.js, populate_list(), pcrud.search onerror: ' + r); }, oncomplete : function() { + if (xul_param('barcodes')) { // incoming from Holdings Maintenance + handle_barcodes( xul_param('barcodes') ); + } }, onresponse : function(r) { try { @@ -315,6 +323,7 @@ function handle_change() { obj.peer_type( $('bpt_menu').value ); bpbcm_list.push( obj ); } + var pcrud = new openils.PermaCrud( { authtoken :ses() }); pcrud.update( bpbcm_list, { 'async' : false, @@ -375,6 +384,7 @@ function handle_remove() { obj.isdeleted(1); bpbcm_list.push( obj ); } + var pcrud = new openils.PermaCrud( { authtoken :ses() }); pcrud.eliminate( bpbcm_list, { 'async' : false, @@ -432,3 +442,35 @@ function handle_opac() { alert('Error in manage_multi_home_items.js, handle_opac(): ' + E); } } + +function handle_barcodes(barcodes) { + try { + var funcs = []; + + for (var i = 0; i < barcodes.length; i++) { + if (typeof rows[barcodes[i]] == 'undefined') { + funcs.push( + function(barcode) { + + return function() { + handle_submit(true,null,barcode); + }; + + }(barcodes[i]) + ) + } + } + + JSAN.use('util.exec'); var exec = new util.exec(); + exec.timer( funcs, 500 ); + + funcs.push( + function() { + exec.clear_timer(); + } + ); + + } catch(E) { + alert('Error in manage_multi_home_items.js, handle_barcodes(): ' + E); + } +} diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties index 86893ca494..90b1df1eb1 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -80,6 +80,7 @@ staff.cat.copy_browser.transfer.success=Volumes transferred. staff.cat.copy_browser.transfer.unexpected_error=All volumes not likely transferred. staff.cat.copy_browser.transfer_items.missing_volume=Please mark a volume as the destination from within holdings maintenance and then try this again. staff.cat.copy_browser.transfer_items.unexpected_error=All copies not likely transferred. +staff.cat.copy_browser.link_as_multi_bib.missing_bib=Please Mark a bib record as a Target for Multi-Bib Items and try this again. staff.cat.copy_browser.missing_library=Missing library list. staff.cat.copy_browser.consortial_copy_count.error=Error retrieving consortial copy count. staff.cat.copy_browser.list_init.tree_location=Location/Barcode -- 2.11.0