[open-ils-commits] r12135 - branches/rel_1_4/Open-ILS/src/extras (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 10 14:19:20 EST 2009


Author: dbs
Date: 2009-02-10 14:19:17 -0500 (Tue, 10 Feb 2009)
New Revision: 12135

Modified:
   branches/rel_1_4/Open-ILS/src/extras/org_tree_html_options.pl
Log:
Backport r12134 from trunk: fixes depth problems with static org_unit selector

Modified: branches/rel_1_4/Open-ILS/src/extras/org_tree_html_options.pl
===================================================================
--- branches/rel_1_4/Open-ILS/src/extras/org_tree_html_options.pl	2009-02-10 19:16:33 UTC (rev 12134)
+++ branches/rel_1_4/Open-ILS/src/extras/org_tree_html_options.pl	2009-02-10 19:19:17 UTC (rev 12135)
@@ -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