From: Jason Etheridge Date: Wed, 7 Sep 2011 07:29:40 +0000 (-0400) Subject: Fix unified interface w/ editing multiple volumes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=42c33a3af8727ff8d0f12490438816e5cf84e2a3;p=evergreen%2Fmasslnc.git Fix unified interface w/ editing multiple volumes Breakage if editing existing items across volumes with non-default values for call number class, prefix, or suffix. This was due to some logic happening within a loop that was sadly referencing data that changed out from under it with every loop iteration (so for example, we were effectively referencing the last rendered class menu instead of each in turn). Remember folks: for (var unsafe = 0; unsafe < 10; unsafe++) { setTimeout( function(safe) { return function() { do_something_with(safe); // good do_something_with(unsafe); // bad }; }(unsafe), 1000 ); } Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- 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 68af8b0ea3..1ec3d0e615 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 @@ -576,9 +576,25 @@ g.render_callnumber_copy_count_entry = function(row,ou_id,count) { var acnp_id = callnumber_composite_key.split(/:/)[1]; var acns_id = callnumber_composite_key.split(/:/).slice(-1)[0]; call_number_column_textbox.value = acn_label; - classification_column_menulist.value = acnc_id; - prefix_column_menulist.value = acnp_id; - suffix_column_menulist.value = acns_id; + + var _call_number_column_box = call_number_column_textbox.parentNode; + + var _classification_column_box = + _call_number_column_box.previousSibling.previousSibling; /* two over to the left */ + var _classification_column_menulist = + _classification_column_box.firstChild; + var _prefix_column_box = + _call_number_column_box.previousSibling; /* one over to the left */ + var _prefix_column_menulist = + _prefix_column_box.firstChild; + var _suffix_column_box = + _call_number_column_box.nextSibling; /* one over to the right */ + var _suffix_column_menulist = + _suffix_column_box.firstChild; + + _classification_column_menulist.value = acnc_id; + _prefix_column_menulist.value = acnp_id; + _suffix_column_menulist.value = acns_id; dump('\tacn_label = ' + acn_label + ' acnc_id = ' + acnc_id + ' acnp_id = ' + acnp_id + ' acns_id = ' + acns_id + '\n'); handle_change_to_callnumber_data({'target':call_number_column_textbox}); } else {