From: Lebbeous Fogle-Weekley Date: Tue, 14 Feb 2012 16:18:27 +0000 (-0500) Subject: Vandelay record match sets: fix bug loading some trees X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bd0057b49bd7179bf71962eff64ce0029e1067e6;p=Evergreen.git Vandelay record match sets: fix bug loading some trees Reported to me by Bill Erickson. The Vandelay Record Match Sets interface was failing to load some simple trees of match set points. Example: http://pastesite.com/31643 The proximate symptom was this error message: Error: dojo.data.ItemFileReadStore: Invalid item argument. Source File: http://dev198.esilibrary.com/js/dojo/dojo/dojo.js Line: 119 but the root cause was a problem in dojoize_match_set_tree(), which was failing to generate unique identifiers for each item in the data store it's responsible for generating. Since that function is only ever used to deal with trees where all the nodes come from the database and have actual IDs, that function now uses the database IDs as is rather than attempting to generate new ones. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js b/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js index 87656a3959..1de99e4c69 100644 --- a/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js +++ b/Open-ILS/web/js/ui/default/conify/global/vandelay/match_set.js @@ -418,20 +418,20 @@ function new_match_set_tree() { * ], * */ -function dojoize_match_set_tree(point, refgen) { +function dojoize_match_set_tree(point, depth) { var root = false; - if (!refgen) { + if (!depth) { if (!point) { return new_match_set_tree(); } - refgen = 0; + depth = 0; root = true; } var bathwater = point.children(); point.children([]); var item = { - "id": (root ? "root" : refgen), + "id": (root ? "root" : point.id()), "name": render_vmsp_label(point), "match_point": point.clone(), "children": [] @@ -443,9 +443,9 @@ function dojoize_match_set_tree(point, refgen) { if (point.children()) { for (var i = 0; i < point.children().length; i++) { var child = point.children()[i]; - item.children.push({"_reference": ++refgen}); + item.children.push({"_reference": child.id()}); results = results.concat( - dojoize_match_set_tree(child, refgen) + dojoize_match_set_tree(child, ++depth) ); } }