From 98309138a694f70383b36c03148ca291a835d5b9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 19 Nov 2013 14:21:38 +0100 Subject: [PATCH] Bug 11263: do not use system locales settings for subscriptions The locales list for subscriptions should not be retrieved from the locales of the system. This patch retrieves the locales list from the Koha DB (in the same way as pref language and opaclanguages). Test plan: Edit a subscription (or a numbering pattern) and verify the list of languages is the same as languages available in Koha. Note: with this patch we loose the saeson translation, it is normal. See report linked. Signed-off-by: Bernardo Gonzalez Kriegel Work as described. No koha-qa errors. New locale is retrieved from installed languages. I wonder if that list can be restricted to 'enabled' ones (parsing syspref language value). Signed-off-by: Katrin Fischer Passes QA script and all tests. Works according to description. Signed-off-by: Galen Charlton --- .../prog/en/modules/serials/subscription-add.tt | 8 ++++---- .../serials/subscription-numberpatterns.tt | 2 +- serials/subscription-add.pl | 17 ++++++++--------- serials/subscription-numberpatterns.pl | 13 +++++++------ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 2923c970b8..62da6147a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -693,14 +693,14 @@ $(document).ready(function() { - If empty, system locale is used + If empty, English is used
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt index 953882fe0e..8c8c28c86e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt @@ -231,7 +231,7 @@ function show_blocking_subs() { [% END %] - If empty, system locale is used + If empty, English is used
    diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index f609102817..c6edab4250 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -213,15 +213,14 @@ if ($op eq 'addsubscription') { } $template->param(numberpatterns => \@numberpatternloop); - # Get installed locales - # FIXME this will not work with all environments. - # If call to locale fails, @locales will be an empty array, which is fine. - my @locales = map { - chomp; - # we don't want POSIX and C locales - /^C|^POSIX$/ ? () : $_ - } `locale -a`; - $template->param(locales => \@locales); + my $languages = [ map { + { + language => $_->{language}, + description => $_->{native_description} || $_->{language} + } + } @{ C4::Languages::getTranslatedLanguages() } ]; + + $template->param( locales => $languages ); output_html_with_http_headers $query, $cookie, $template->output; } diff --git a/serials/subscription-numberpatterns.pl b/serials/subscription-numberpatterns.pl index c2a9800dc4..065ab01e4d 100755 --- a/serials/subscription-numberpatterns.pl +++ b/serials/subscription-numberpatterns.pl @@ -105,17 +105,18 @@ if($op && ($op eq 'new' || $op eq 'modify')) { my @frequencies = GetSubscriptionFrequencies(); my @subtypes; push @subtypes, { value => $_ } for (qw/ issues weeks months /); - my @locales = map { - chomp; - /^C|^POSIX$/ ? () : $_ - } `locale -a`; + my $languages = [ map { + { + language => $_->{language}, + description => $_->{native_description} || $_->{language} + } + } @{ C4::Languages::getTranslatedLanguages() } ]; $template->param( $op => 1, frequencies_loop => \@frequencies, subtypes_loop => \@subtypes, - locales => \@locales, - DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + locales => $languages, ); output_html_with_http_headers $input, $cookie, $template->output; exit; -- 2.39.5