Bugzilla – Attachment 61620 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.40 KB, created by
Jonathan Druart
on 2017-03-24 16:30:51 UTC
(
hide
)
Description:
Bug 17762: Send lang to GetPreparedLetter
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-24 16:30:51 UTC
Size:
13.40 KB
patch
obsolete
>From 72fa33aa38168e3354bc7d5bc2d60eabbba15a9a 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 | 1 + > 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, 34 insertions(+) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 3fca9eb..a329f53 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -3030,6 +3030,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 efdf817..8e44900 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3349,6 +3349,7 @@ sub SendCirculationAlert { > letter_code => $type, > branchcode => $branch, > message_transport_type => $mtt, >+ lang => $borrower->{lang}, > tables => { > $issues_table => $item->{itemnumber}, > 'items' => $item->{itemnumber}, >diff --git a/C4/Members.pm b/C4/Members.pm >index 8e73872..57fd0fb 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1166,6 +1166,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) { >@@ -1226,6 +1228,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 c26b5f0..ceb465e 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} ); > >@@ -1028,6 +1030,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 6a1756f..884f3fd 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -233,6 +233,7 @@ sub AddReserve { > module => 'reserves', > letter_code => 'HOLDPLACED', > branchcode => $branch, >+ lang => $borrower->{lang}, > tables => { > 'branches' => $library, > 'borrowers' => $borrower, >@@ -2002,6 +2003,7 @@ sub _koha_notify_reserve { > my %letter_params = ( > module => 'reserves', > branchcode => $hold->branchcode, >+ lang => $borrower->{lang}, > tables => { > 'branches' => $library, > 'borrowers' => $borrower, >@@ -2347,6 +2349,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, >@@ -2358,6 +2361,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 7c35c5d..a23a609 100644 >--- a/Koha/Patron/Password/Recovery.pm >+++ b/Koha/Patron/Password/Recovery.pm >@@ -143,6 +143,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