From: erickson Date: Mon, 4 Feb 2008 15:36:28 +0000 (+0000) Subject: repaired logic error in union-tree builder X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fcc2a1343be2f983f35d6c9028d50bd6ef58af8c;p=Evergreen.git repaired logic error in union-tree builder git-svn-id: svn://svn.open-ils.org/ILS/trunk@8592 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/python/oils/org.py b/Open-ILS/src/python/oils/org.py index 431fc6dd05..0a4ad969a3 100644 --- a/Open-ILS/src/python/oils/org.py +++ b/Open-ILS/src/python/oils/org.py @@ -105,11 +105,14 @@ class OrgUtil(object): main_node = main_tree while node.id() == main_node.id(): - node = node.children()[0] - main_node = main_node.children()[0] + child = node.children()[0] + main_child_node = main_node.children()[0] + child.parent_ou(node) + main_child_node.parent_ou(main_node) + node = child + main_node = main_child_node - print main_node.id() - OrgUtil.get_org_unit(main_node.parent_ou()).children().append(node) + main_node.parent_ou().children().append(node) return main_tree @@ -127,14 +130,14 @@ class OrgUtil(object): return orglist @staticmethod - def debug_org(org_unit, indent=0): + def debug_tree(org_unit, indent=0): ''' Simple function to print the tree of orgs provided ''' import sys for i in range(indent): - sys.stdout.write('-') - print org_unit.shortname() + sys.stdout.write('_') + print '%s id=%s depth=%s' % (org_unit.shortname(), str(org_unit.id()), str(OrgUtil.get_org_type(org_unit).depth())) indent += 1 for child in org_unit.children(): - OrgUtil.debug_org(child, indent) + OrgUtil.debug_tree(child, indent)