]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/org_tree_proximity.pl
Executable scripts
[Evergreen.git] / Open-ILS / src / extras / org_tree_proximity.pl
1 #!/usr/bin/perl
2 # -----------------------------------------------------------------------
3 # Copyright (C) 2008  Laurentian University
4 # Dan Scott <dscott@laurentian.ca>
5
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 # -----------------------------------------------------------------------
16
17 # calculate the proximity of organizations in the organization tree
18
19 # vim:noet:ts=4:sw=4
20
21 use OpenSRF::AppSession;
22 use OpenSRF::System;
23 use OpenILS::Utils::Fieldmapper;
24 use OpenSRF::Utils::SettingsClient;
25
26 die "usage: perl org_tree_proximity.pl <bootstrap_config>" unless $ARGV[0];
27 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
28
29 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
30
31 my $ses = OpenSRF::AppSession->create("open-ils.storage");
32 my $result = $ses->request("open-ils.storage.actor.org_unit.refresh_proximity");
33
34 if ($result) {
35         print "Successfully updated the organization proximity";
36 } else {
37         print "Failed to update the organiziation proximity";
38 }
39
40 $ses->disconnect();