[open-ils-commits] r12134 - trunk/Open-ILS/src/extras (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 10 14:16:36 EST 2009


Author: dbs
Date: 2009-02-10 14:16:33 -0500 (Tue, 10 Feb 2009)
New Revision: 12134

Modified:
   trunk/Open-ILS/src/extras/org_tree_html_options.pl
Log:
Get the real org_unit_type depth from aout


Modified: trunk/Open-ILS/src/extras/org_tree_html_options.pl
===================================================================
--- trunk/Open-ILS/src/extras/org_tree_html_options.pl	2009-02-10 19:08:51 UTC (rev 12133)
+++ trunk/Open-ILS/src/extras/org_tree_html_options.pl	2009-02-10 19:16:33 UTC (rev 12134)
@@ -6,6 +6,7 @@
 use OpenILS::Utils::Fieldmapper;
 use OpenSRF::Utils::SettingsClient;
 use Unicode::Normalize;
+use Data::Dumper;
 
 die "usage: perl org_tree_html_options.pl <bootstrap_config> <output_file>" unless $ARGV[1];
 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
@@ -17,6 +18,12 @@
 my $ses = OpenSRF::AppSession->create("open-ils.actor");
 my $tree = $ses->request("open-ils.actor.org_tree.retrieve")->gather(1);
 
+my @types;
+my $aout = $ses->request("open-ils.actor.org_types.retrieve")->gather(1);
+foreach my $type (@$aout) {
+	$types[int($type->id)] = $type;
+}
+
 print_option($tree);
 
 $ses->disconnect();
@@ -28,7 +35,7 @@
 	my $node = shift;
 	return unless ($node->opac_visible =~ /^[y1t]+/i);
 
-	my $depth = $node->ou_type - 1;
+	my $depth = $types[$node->ou_type]->depth;
 	my $sname = entityize($node->shortname);
 	my $name = entityize($node->name);
 	my $kids = $node->children;



More information about the open-ils-commits mailing list