From 9911ea7643e742a52cbf8446bbbf8de799eb7a1b Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 7 Sep 2011 03:29:40 -0400 Subject: [PATCH] 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 --- .../staff_client/server/cat/volume_copy_creator.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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 954c191daa..595706876a 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 @@ -561,9 +561,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 { -- 2.11.0