From c66170141315ea94c50168d47eaab3c021ef8c59 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 Signed-off-by: Nick Clemens --- .../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 bba77f0..59fb3bd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -460,6 +460,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 768b163..8672a20 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -265,6 +265,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/ ) { @@ -772,6 +774,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 2ab8174..0eb6927 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -331,8 +331,15 @@ if ( C4::Context->preference("ExportCircHistory") ) { # 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.1.4