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