2 use strict; use warnings;
4 # ------------------------------------------------------------
5 # turns the actor.org_lasso table into a js file
6 # ------------------------------------------------------------
9 use OpenILS::Utils::Fieldmapper;
10 use OpenSRF::Utils::SettingsClient;
11 use OpenSRF::Utils::JSON;
13 die "usage: perl org_tree_js.pl <bootstrap_config>" unless $ARGV[0];
14 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
16 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
18 # must be loaded after the IDL is parsed
19 require OpenILS::Utils::CStoreEditor;
21 # fetch the org_unit's and org_unit_type's
22 my $e = OpenILS::Utils::CStoreEditor->new;
23 my $lassos = $e->request(
24 'open-ils.cstore.direct.actor.org_lasso.search.atomic',
25 {id => {"!=" => undef}},
26 {order_by => {lasso => 'name'}}
30 "var _lasso = [\n new lasso(" .
31 join( "),\n new lasso(", map { OpenSRF::Utils::JSON->perl2JSON( bless($_, 'ARRAY') ) } @$lassos ) .
32 ")\n]; /* Org Search Groups (Lassos) */ \n";