From dc14808aa867fb3b9176970e5a185e4c1b614af3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Dec 2016 10:52:30 +0000 Subject: [PATCH] Bug 17762: Add the lang attribute to the patron form Not the opac because we do not want the patron to modify it, they won't be necessary translated. Sponsored-by: Orex Digital Signed-off-by: Hugo Agud --- .../prog/en/modules/members/memberentrygen.tt | 25 ++++++++++++++++++++++ .../prog/en/modules/members/moremember.tt | 6 ++++++ members/memberentry.pl | 7 ++++++ members/moremember.pl | 7 ++++++ 4 files changed, 45 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index ff3ef68..3221b4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -720,6 +720,31 @@ $(document).ready(function() { [% END %] + [% IF Koha.Preference('TranslateNotices') %] +
  • + + +
  • + [% END %] [% UNLESS nodateenrolled && noopacnote && noborrowernotes %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 271b30b..0e2dcbe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -456,6 +456,12 @@ function validate1(date) { [% END %] [% END %] + [% IF Koha.Preference('TranslateNotices') %] +
  • + Preferred language for notices: + [% translated_language %] +
  • + [% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index ef0aa90..a5049df 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -267,6 +267,8 @@ $newdata{'city'} = $input->param('city') if defined($input->param('city')) $newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode')); $newdata{'country'} = $input->param('country') if defined($input->param('country')); +$newdata{'lang'} = $input->param('lang') if defined($input->param('lang')); + # builds default userid # userid input text may be empty or missing because of syspref BorrowerUnwantedField if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ ) { @@ -779,6 +781,11 @@ if ( defined $min ) { ); } +if ( C4::Context->preference('TranslateNotices') ) { + my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') ); + $template->param( languages => $translated_languages ); +} + output_html_with_http_headers $input, $cookie, $template->output; sub parse_extended_patron_attributes { diff --git a/members/moremember.pl b/members/moremember.pl index b3e8d76..598f21a 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -330,8 +330,15 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { # in template => instutitional (A for Adult, C for children) $template->param( $data->{'categorycode'} => 1 ); + +# Display the language description instead of the code +# Note that this is certainly wrong +my ( $subtag, $region ) = split '-', $patron->lang; +my $translated_language = C4::Languages::language_get_description( $subtag, $subtag, 'language' ); + $template->param( patron => $patron, + translated_language => $translated_language, detailview => 1, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, -- 2.9.3