[open-ils-commits] r10873 - in trunk/Open-ILS: examples
src/perlmods/OpenILS/Application
src/perlmods/OpenILS/Application/Search
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Oct 20 12:37:52 EDT 2008
Author: erickson
Date: 2008-10-20 12:37:49 -0400 (Mon, 20 Oct 2008)
New Revision: 10873
Modified:
trunk/Open-ILS/examples/opensrf.xml.example
trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
added a global default locale configuration setting (for when no org setting exists). created an org-locale finder as an addition to the user locale finder. using default locale info as preferred language in opac searches where not provided by the client
Modified: trunk/Open-ILS/examples/opensrf.xml.example
===================================================================
--- trunk/Open-ILS/examples/opensrf.xml.example 2008-10-20 16:37:10 UTC (rev 10872)
+++ trunk/Open-ILS/examples/opensrf.xml.example 2008-10-20 16:37:49 UTC (rev 10873)
@@ -9,6 +9,9 @@
<default>
+ <!-- unless otherwise overidden, use this locale -->
+ <default_locale>en-US</default_locale>
+
<dirs>
<log>LOCALSTATEDIR/log</log> <!-- unix::server log files -->
<sock>LOCALSTATEDIR/lock</sock> <!-- unix::server sock files -->
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm 2008-10-20 16:37:10 UTC (rev 10872)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm 2008-10-20 16:37:49 UTC (rev 10873)
@@ -12,6 +12,7 @@
use OpenILS::Utils::CStoreEditor;
use OpenILS::Const qw/:const/;
use Unicode::Normalize;
+use OpenSRF::Utils::SettingsClient;
# ---------------------------------------------------------------------------
# Pile of utilty methods used accross applications.
@@ -1463,7 +1464,7 @@
# returns the user's configured locale as a string. Defaults to en-US if none is configured.
sub get_user_locale {
my($self, $user_id, $e) = @_;
- $e ||=OpenILS::Utils::CStoreEditor->new;
+ $e ||= OpenILS::Utils::CStoreEditor->new;
# first, see if the user has an explicit locale set
my $setting = $e->search_actor_user_setting(
@@ -1471,8 +1472,23 @@
return OpenSRF::Utils::JSON->JSON2perl($setting->value) if $setting;
my $user = $e->retrieve_actor_user($user_id) or return $e->event;
+ return $self->get_org_locale($user->home_ou, $e);
+}
- my $locale = $self->ou_ancestor_setting_value($user->home_ou, 'global.default_locale', $e);
+# returns org locale setting
+sub get_org_locale {
+ my($self, $org_id, $e) = @_;
+ $e ||= OpenILS::Utils::CStoreEditor->new;
+
+ my $locale;
+ if(defined $org_id) {
+ $locale = $self->ou_ancestor_setting_value($org_id, 'global.default_locale', $e);
+ return $locale if $locale;
+ }
+
+ # system-wide default
+ my $sclient = OpenSRF::Utils::SettingsClient->new;
+ $locale = $sclient->config_value('default_locale');
return $locale if $locale;
# if nothing else, fallback to locale=cowboy
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-10-20 16:37:10 UTC (rev 10872)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2008-10-20 16:37:49 UTC (rev 10873)
@@ -538,6 +538,8 @@
if $sclient->config_value(apps => 'open-ils.search',
app_settings => 'use_staged_search') =~ /true/i;
+ $arghash->{preferred_language} = $U->get_org_locale($arghash->{org_unit})
+ unless $arghash->{preferred_language};
$method = $self->method_lookup($method);
my ($data) = $method->run($arghash, $docache);
More information about the open-ils-commits
mailing list