2 # turns the orgTree and orgTypes into js files
4 use OpenSRF::AppSession;
7 die "usage: perl org_tree_js.pl <bootstrap_config>" unless $ARGV[0];
8 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
10 my $ses = OpenSRF::AppSession->create("open-ils.actor");
11 my $req = $ses->request("open-ils.actor.org_tree.retrieve");
13 my $tree = $req->gather(1);
15 my $ses2 = OpenSRF::AppSession->create("open-ils.storage");
16 my $req2 = $ses2->request("open-ils.storage.direct.actor.org_unit_type.retrieve.all.atomic");
17 my $types = $req2->gather(1);
19 my $tree_string = JSON->perl2JSON($tree);
20 my $types_string = JSON->perl2JSON($types);
22 $tree_string =~ s/\"/\\\"/g;
23 $types_string =~ s/\"/\\\"/g;
25 $tree_string = "var globalOrgTree = JSON2js(\"$tree_string\");";
26 $types_string = "var globalOrgTypes = JSON2js(\"$types_string\");";
28 print "$tree_string\n\n$types_string\n";