]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/locale_html_options.pl
Add OILS_SIP_MSG_BILL_ERR for when an error occurs getting bills.
[working/Evergreen.git] / Open-ILS / src / extras / locale_html_options.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 # Turns supported locales into a static HTML option list
5
6 use OpenSRF::AppSession;
7 use OpenSRF::System;
8 use OpenILS::Utils::Fieldmapper;
9 use OpenSRF::Utils::SettingsClient;
10 use OpenILS::Application::AppUtils;
11
12 die "usage: perl locale_html_options.pl <bootstrap_config> <output_file>" unless $ARGV[1];
13 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
14
15 open FILE, ">$ARGV[1]";
16
17 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
18
19 my $ses = OpenSRF::AppSession->create("open-ils.cstore");
20 my $locales = $ses->request("open-ils.cstore.direct.config.i18n_locale.search.atomic", {"code" => {"!=" => undef}}, {"order_by" => {"i18n_l" => "name"}})->gather();
21
22 print_option($locales);
23
24 $ses->disconnect();
25 close FILE;
26
27
28 sub print_option {
29         my $locales = shift;
30         print FILE "<select name='locale'>\n";
31         foreach my $locale (@$locales) {
32                 my $code = OpenILS::Application::AppUtils->entityize($locale->code);
33                 my $name = OpenILS::Application::AppUtils->entityize($locale->name);
34                 print FILE "  <option value='$code'>$name</option>\n";
35         }
36         print FILE "</select>\n";
37 }
38