Bugzilla – Attachment 63201 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.42 KB, created by
Nick Clemens (kidclamp)
on 2017-05-05 20:21:36 UTC
(
hide
)
Description:
Bug 17762: Add the lang attribute to the patron form
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-05 20:21:36 UTC
Size:
5.42 KB
patch
obsolete
>From c66170141315ea94c50168d47eaab3c021ef8c59 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 > >Signed-off-by: Hugo Agud <hagud@orex.es> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../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() { > </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 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 %] > </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 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 <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.1.4
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