From: Jason Etheridge Date: Wed, 23 Feb 2011 06:01:59 +0000 (-0500) Subject: have volume/copy creator refresh item attribute editor in unified interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=68814954812ef0362a4f13a3de5817c825395e9c;p=evergreen%2Fequinox.git have volume/copy creator refresh item attribute editor in unified interface --- diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index e0edef1603..e36fac4b60 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -2,8 +2,6 @@ var g = {}; g.map_acn = {}; -var xulG = {}; - function $(id) { return document.getElementById(id); } function my_init() { @@ -166,6 +164,21 @@ function my_init() { g.render(); g.check_for_unmet_required_fields(); + if (xulG.unified_interface) { + xulG.refresh_copy_editor = function() { + try { + g.copies = xulG.copies; + g.original_copies = js2JSON( g.copies ); + g.summarize( g.copies ); + g.render(); + g.check_for_unmet_required_fields(); + document.getElementById(caption.id).focus(); + } catch(E) { + alert('Error in copy_editor.js, xulG.refresh_copy_editor(): ' + E); + } + } + } + } catch(E) { var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/copy_editor.js', E]); try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); } diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index 0f5a40ecf1..07398b2b86 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -358,6 +358,14 @@ g.render_barcode_entry = function(node,callnumber,count,ou_id) { $("catStrings").getString('staff.cat.volume_copy_creator.render_barcode_entry.alert_confirm')); setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0); } + if (xulG.unified_interface) { + g.gather_copies(); + try { + xulG.refresh_copy_editor(); + } catch(E) { + alert('Error in volume_copy_editor.js trying to call xulG.refresh_copy_editor(): ' + E); + } + } }, false); tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false ); } @@ -404,10 +412,8 @@ g.generate_barcodes = function() { g.new_node_id = -1; -g.stash_and_close = function(param) { - +g.gather_copies = function() { try { - var nl = document.getElementsByTagName('textbox'); var volumes_hash = {}; @@ -480,20 +486,34 @@ g.stash_and_close = function(param) { for (var i = 0; i < volumes_hash[ou_id][cn_label].length; i++) { var barcode = volumes_hash[ou_id][cn_label][i].barcode; var acp_id = volumes_hash[ou_id][cn_label][i].acp_id; - var copy; - if (acp_id < 0) { + var copy = g.id_copy_map[ acp_id ]; + if (!copy) { copy = new_copy(acp_id,ou_id,acn_id,barcode); + g.id_copy_map[ acp_id ] = copy; } else { - copy = g.id_copy_map[ acp_id ]; - copy.barcode( barcode ); - copy.call_number( acn_id ); copy.ischanged('1'); } + copy.barcode( barcode ); + copy.call_number( acn_id ); copies.push( copy ); } } } + xulG.copies = copies; + return copies; + + } catch(E) { + g.error.standard_unexpected_error_alert('Error in volume_copy_creator.js, g.gather_copies():',E); + } +} + +g.stash_and_close = function(param) { + + try { + + var copies = g.gather_copies(); + var dont_close = false; JSAN.use('util.window'); var win = new util.window(); if (copies.length > 0) {