Bugzilla – Attachment 59459 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: Send lang to GetPreparedLetter
Bug-17762-Send-lang-to-GetPreparedLetter.patch (text/plain), 13.78 KB, created by
Jonathan Druart
on 2017-01-23 18:33:12 UTC
(
hide
)
Description:
Bug 17762: Send lang to GetPreparedLetter
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-23 18:33:12 UTC
Size:
13.78 KB
patch
obsolete
>From 8df5740b94c1d0d399f978ebfa6c05b9d206f86b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 8 Dec 2016 16:11:21 +0100 >Subject: [PATCH] Bug 17762: Send lang to GetPreparedLetter > >This patch set the lang parameter when C4::Letters::GetPreparedLetter is >called to generate the notice. >Note that we do not need to pass it if want_librarian is set. > >TODO: I do not know what to do with TransferSlip > >Sponsored-by: Orex Digital > >Signed-off-by: Hugo Agud <hagud@orex.es> >--- > C4/Acquisition.pm | 1 + > C4/Circulation.pm | 2 ++ > C4/Members.pm | 3 +++ > C4/Overdues.pm | 3 +++ > C4/Reserves.pm | 4 ++++ > C4/Suggestions.pm | 2 ++ > Koha/ArticleRequest.pm | 1 + > Koha/Patron/Discharge.pm | 2 ++ > Koha/Patron/Password/Recovery.pm | 1 + > circ/article-request-slip.pl | 3 +++ > misc/cronjobs/advance_notices.pl | 3 +++ > misc/cronjobs/membership_expiry.pl | 3 +++ > misc/cronjobs/notice_unprocessed_suggestions.pl | 1 + > misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl | 1 + > opac/opac-memberentry.pl | 1 + > opac/opac-shareshelf.pl | 4 ++++ > 16 files changed, 35 insertions(+) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index c113c16..ef6a507 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -3028,6 +3028,7 @@ sub NotifyOrderUsers { > module => 'acquisition', > letter_code => 'ACQ_NOTIF_ON_RECEIV', > branchcode => $library->{branchcode}, >+ lang => $borrower->{lang}, > tables => { > 'branches' => $library, > 'borrowers' => $borrower, >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 0230429..28692ac 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3375,6 +3375,7 @@ sub SendCirculationAlert { > letter_code => $type, > branchcode => $branch, > message_transport_type => $_, >+ lang => $borrower->{lang}, > tables => { > $issues_table => $item->{itemnumber}, > 'items' => $item->{itemnumber}, >@@ -3392,6 +3393,7 @@ sub SendCirculationAlert { > letter_code => $type, > branchcode => $branch, > message_transport_type => $_, >+ lang => $borrower->{lang}, > tables => { > $issues_table => $item->{itemnumber}, > 'items' => $item->{itemnumber}, >diff --git a/C4/Members.pm b/C4/Members.pm >index a501041..188079e 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1212,6 +1212,8 @@ sub IssueSlip { > # FIXME Check callers before removing this statement > #return unless $borrowernumber; > >+ my $patron = Koha::Patrons->find( $borrowernumber ); >+ > my @issues = @{ GetPendingIssues($borrowernumber) }; > > for my $issue (@issues) { >@@ -1272,6 +1274,7 @@ sub IssueSlip { > module => 'circulation', > letter_code => $letter_code, > branchcode => $branch, >+ lang => $patron->lang, > tables => { > 'branches' => $branch, > 'borrowers' => $borrowernumber, >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 8300a1e..2b3072d 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -994,6 +994,8 @@ sub parse_overdues_letter { > return unless ( exists $params->{$required} && $params->{$required} ); > } > >+ my $patron = Koha::Patrons->find( $params->{borrowernumber} ); >+ > my $substitute = $params->{'substitute'} || {}; > $substitute->{today} ||= output_pref( { dt => dt_from_string, dateonly => 1} ); > >@@ -1034,6 +1036,7 @@ sub parse_overdues_letter { > module => 'circulation', > letter_code => $params->{'letter_code'}, > branchcode => $params->{'branchcode'}, >+ lang => $patron->lang, > tables => \%tables, > substitute => $substitute, > repeat => { item => \@item_tables }, >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 3f124a6..5f6a0f2 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -232,6 +232,7 @@ sub AddReserve { > module => 'reserves', > letter_code => 'HOLDPLACED', > branchcode => $branch, >+ lang => $borrower->{lang}, > tables => { > 'branches' => $library, > 'borrowers' => $borrower, >@@ -2000,6 +2001,7 @@ sub _koha_notify_reserve { > my %letter_params = ( > module => 'reserves', > branchcode => $hold->branchcode, >+ lang => $borrower->{lang}, > tables => { > 'branches' => $library, > 'borrowers' => $borrower, >@@ -2345,6 +2347,7 @@ sub ReserveSlip { > my ($branch, $borrowernumber, $biblionumber) = @_; > > # return unless ( C4::Context->boolean_preference('printreserveslips') ); >+ my $patron = Koha::Patrons->find( $borrowernumber ); > > my $reserve_id = GetReserveId({ > biblionumber => $biblionumber, >@@ -2356,6 +2359,7 @@ sub ReserveSlip { > module => 'circulation', > letter_code => 'HOLD_SLIP', > branchcode => $branch, >+ lang => $patron->lang, > tables => { > 'reserves' => $reserve, > 'branches' => $reserve->{branchcode}, >diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm >index 8e76cea..3839e4e 100644 >--- a/C4/Suggestions.pm >+++ b/C4/Suggestions.pm >@@ -502,11 +502,13 @@ sub ModSuggestion { > > # fetch the entire updated suggestion so that we can populate the letter > my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} ); >+ my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} ); > if ( > my $letter = C4::Letters::GetPreparedLetter( > module => 'suggestions', > letter_code => $full_suggestion->{STATUS}, > branchcode => $full_suggestion->{branchcode}, >+ lang => $patron->lang, > tables => { > 'branches' => $full_suggestion->{branchcode}, > 'borrowers' => $full_suggestion->{suggestedby}, >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index 75318fd..7f1a594 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -108,6 +108,7 @@ sub notify { > module => 'circulation', > letter_code => "AR_$status", > message_transport_type => 'email', >+ lang => $self->borrower->lang, > tables => { > article_requests => $self->id, > borrowers => $self->borrowernumber, >diff --git a/Koha/Patron/Discharge.pm b/Koha/Patron/Discharge.pm >index d519d40..289fdb0 100644 >--- a/Koha/Patron/Discharge.pm >+++ b/Koha/Patron/Discharge.pm >@@ -107,9 +107,11 @@ sub generate_as_pdf { > my ($params) = @_; > return unless $params->{borrowernumber}; > >+ my $patron = Koha::Patrons->find( $params->{borrowernumber} ); > my $letter = C4::Letters::GetPreparedLetter( > module => 'members', > letter_code => 'DISCHARGE', >+ lang => $patron->lang, > tables => { borrowers => $params->{borrowernumber}, branches => $params->{'branchcode'}, }, > ); > >diff --git a/Koha/Patron/Password/Recovery.pm b/Koha/Patron/Password/Recovery.pm >index 04491e6..b978866 100644 >--- a/Koha/Patron/Password/Recovery.pm >+++ b/Koha/Patron/Password/Recovery.pm >@@ -144,6 +144,7 @@ sub SendPasswordRecoveryEmail { > module => 'members', > letter_code => 'PASSWORD_RESET', > branchcode => $borrower->branchcode, >+ lang => $borrower->lang, > substitute => > { passwordreseturl => $uuidLink, user => $borrower->userid }, > ); >diff --git a/circ/article-request-slip.pl b/circ/article-request-slip.pl >index 6a7087d..7c8ec50 100755 >--- a/circ/article-request-slip.pl >+++ b/circ/article-request-slip.pl >@@ -25,6 +25,7 @@ use C4::Context; > use C4::Output; > use C4::Auth; > use Koha::ArticleRequests; >+use Koha::Patrons; > > my $cgi = new CGI; > >@@ -43,11 +44,13 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $ar = Koha::ArticleRequests->find($id); > > $template->param( article_request => $ar ); >+my $patron = Koha::Patrons->find( $ar->borrowernumber ); > > my $slip = C4::Letters::GetPreparedLetter( > module => 'circulation', > letter_code => 'AR_SLIP', > message_transport_type => 'print', >+ lang => $patron->lang, > tables => { > article_requests => $ar->id, > borrowers => $ar->borrowernumber, >diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl >index 855492e..7eb3809 100755 >--- a/misc/cronjobs/advance_notices.pl >+++ b/misc/cronjobs/advance_notices.pl >@@ -58,6 +58,7 @@ use C4::Overdues; > use Koha::DateUtils; > use C4::Log; > use Koha::Libraries; >+use Koha::Patrons; > > =head1 NAME > >@@ -467,6 +468,7 @@ sub parse_letter { > foreach my $required ( qw( letter_code borrowernumber ) ) { > return unless exists $params->{$required}; > } >+ my $patron = Koha::Patrons->find( $params->{borrowernumber} ); > > my %table_params = ( 'borrowers' => $params->{'borrowernumber'} ); > >@@ -486,6 +488,7 @@ sub parse_letter { > module => 'circulation', > letter_code => $params->{'letter_code'}, > branchcode => $table_params{'branches'}, >+ lang => $patron->lang, > substitute => $params->{'substitute'}, > tables => \%table_params, > message_transport_type => $params->{message_transport_type}, >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index 260a9f8..1b6ea81 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -130,6 +130,8 @@ use C4::Context; > use C4::Letters; > use C4::Log; > >+use Koha::Patrons; >+ > # These are defaults for command line options. > my $confirm; # -c: Confirm that the user has read and configured this script. > my $nomail; # -n: No mail. Will not send any emails. >@@ -185,6 +187,7 @@ while ( my $recent = $upcoming_mem_expires->next ) { > module => 'members', > letter_code => $letter_type, > branchcode => $recent->branchcode, >+ lang => $recent->lang, > tables => { > borrowers => $recent->borrowernumber, > branches => $recent->branchcode, >diff --git a/misc/cronjobs/notice_unprocessed_suggestions.pl b/misc/cronjobs/notice_unprocessed_suggestions.pl >index 4c370e8..a0c42ed 100755 >--- a/misc/cronjobs/notice_unprocessed_suggestions.pl >+++ b/misc/cronjobs/notice_unprocessed_suggestions.pl >@@ -58,6 +58,7 @@ for my $number_of_days (@days) { > module => 'suggestions', > letter_code => 'TO_PROCESS', > branchcode => $patron->{branchcode}, >+ lang => $patron->{lang}, > tables => { > suggestions => $suggestion->{suggestionid}, > branches => $patron->{branchcode}, >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index 1299b7d..54c2592 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -123,6 +123,7 @@ foreach my $type (@types) { > my $letter = C4::Letters::GetPreparedLetter( > module => $module, > letter_code => $code, >+ lang => 'default', # It does not sound useful to send a lang here > tables => { > borrowers => $issues->{'borrowernumber'}, > biblio => $issues->{'biblionumber'}, >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index c1610a1..fb5c996 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -153,6 +153,7 @@ if ( $action eq 'create' ) { > my $letter = C4::Letters::GetPreparedLetter( > module => 'members', > letter_code => 'OPAC_REG_VERIFY', >+ lang => 'default', # Patron does not have a preferred language defined yet > tables => { > borrower_modifications => $verification_token, > }, >diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl >index b2f5c8b..89d7dc9 100755 >--- a/opac/opac-shareshelf.pl >+++ b/opac/opac-shareshelf.pl >@@ -169,11 +169,14 @@ sub notify_owner { > my $toaddr = C4::Members::GetNoticeEmailAddress( $param->{owner} ); > return if !$toaddr; > >+ my $patron = Koha::Patrons->find( $param->{owner} ); >+ > #prepare letter > my $letter = C4::Letters::GetPreparedLetter( > module => 'members', > letter_code => 'SHARE_ACCEPT', > branchcode => C4::Context->userenv->{"branch"}, >+ lang => $patron->lang, > tables => { borrowers => $param->{loggedinuser}, }, > substitute => { listname => $param->{shelfname}, }, > ); >@@ -239,6 +242,7 @@ sub send_invitekey { > module => 'members', > letter_code => 'SHARE_INVITE', > branchcode => C4::Context->userenv->{"branch"}, >+ lang => 'default', # Not sure how we could use something more useful else here > tables => { borrowers => $param->{loggedinuser}, }, > substitute => { > listname => $param->{shelfname}, >-- >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