Bugzilla – Attachment 58136 Details for
Bug 17762
Ability to translate notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17762: Add the lang attribute to the patron form
Bug-17762-Add-the-lang-attribute-to-the-patron-for.patch (text/plain), 5.34 KB, created by
Jonathan Druart
on 2016-12-12 17:02:19 UTC
(
hide
)
Description:
Bug 17762: Add the lang attribute to the patron form
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-12 17:02:19 UTC
Size:
5.34 KB
patch
obsolete
>From 07040a4ea30013b1cca26fd312cff4894715e892 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >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 >--- > .../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 a66826d..674f3fb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -715,6 +715,31 @@ $(document).ready(function() { > </select> > </li> > [% END %] >+ [% IF Koha.Preference('TranslateNotices') %] >+ <li> >+ <label for="lang">Preferred language for notices: </label> >+ <select id="lang" name="lang"> >+ <option value="default">Default</option> >+ [% FOR language IN languages %] >+ [% FOR sublanguage IN language.sublanguages_loop %] >+ [% IF language.plural %] >+ [% IF sublanguage.rfc4646_subtag == lang %] >+ <option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option> >+ [% ELSE %] >+ <option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</option> >+ [% END %] >+ [% ELSE %] >+ [% IF sublanguage.rfc4646_subtag == lang %] >+ <option value="[% sublanguage.rfc4646_subtag %]" selected="selected">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option> >+ [% ELSE %] >+ <option value="[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</option> >+ [% END %] >+ [% END %] >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% END %] > </ol> > </fieldset> > [% 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 209671e..260a81c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -452,6 +452,12 @@ function validate1(date) { > [% END %] > </li> > [% END %] >+ [% IF Koha.Preference('TranslateNotices') %] >+ <li> >+ <span class="label">Preferred language for notices: </span> >+ [% translated_language %] >+ </li> >+ [% END %] > </ol> > </div> > </div> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 61ebed9..bee09db 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 70aed84..003e061 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -325,8 +325,15 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > > # in template <TMPL_IF name="I"> => 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17762
:
58133
|
58134
|
58135
|
58136
|
58137
|
58138
|
58139
|
58140
|
58141
|
58525
|
59452
|
59453
|
59454
|
59455
|
59456
|
59457
|
59458
|
59459
|
59460
|
59461
|
61614
|
61615
|
61616
|
61617
|
61618
|
61619
|
61620
|
61621
|
61622
|
61623
|
61624
|
63199
|
63200
|
63201
|
63202
|
63203
|
63204
|
63205
|
63206
|
63207
|
63208
|
63209
|
63210
|
63211