Bugzilla – Attachment 166400 Details for
Bug 31627
Add ability to embed the letter ID in outgoing email notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31627: (QA follow-up) Catch more locations
Bug-31627-QA-follow-up-Catch-more-locations.patch (text/plain), 5.59 KB, created by
Martin Renvoize (ashimema)
on 2024-05-08 12:33:18 UTC
(
hide
)
Description:
Bug 31627: (QA follow-up) Catch more locations
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-05-08 12:33:18 UTC
Size:
5.59 KB
patch
obsolete
>From 75fb8ef09c69c386cb233da761e37e103470599e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 8 May 2024 13:22:02 +0100 >Subject: [PATCH] Bug 31627: (QA follow-up) Catch more locations > >This patch moves the header set into Koha::Email->create and passes the >template_id in a few additional locations to ensure we catch more cases. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Letters.pm | 27 ++++++++++++++++----------- > Koha/Email.pm | 6 +++++- > t/Koha/Email.t | 6 +++++- > 3 files changed, 26 insertions(+), 13 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 6bc6e870bd3..dfb7b786940 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -330,11 +330,12 @@ sub SendAlerts { > # FIXME: This 'default' behaviour should be moved to Koha::Email > my $mail = Koha::Email->create( > { >- to => $email, >- from => $library->branchemail, >- reply_to => $library->branchreplyto, >- sender => $library->branchreturnpath, >- subject => "" . $letter->{title}, >+ to => $email, >+ from => $library->branchemail, >+ reply_to => $library->branchreplyto, >+ sender => $library->branchreturnpath, >+ subject => "" . $letter->{title}, >+ template_id => $letter->{id}, > } > ); > >@@ -486,8 +487,7 @@ sub SendAlerts { > cc => join( ',', @cc ), > ( > ( >- C4::Context->preference("ClaimsBccCopy") >- && ( $type eq 'claimacquisition' >+ C4::Context->preference("ClaimsBccCopy") && ( $type eq 'claimacquisition' > || $type eq 'claimissues' ) > ) > ? ( bcc => $userenv->{emailaddress} ) >@@ -510,7 +510,8 @@ sub SendAlerts { > : () > ) > ), >- subject => "" . $letter->{title}, >+ subject => "" . $letter->{title}, >+ template_id => $letter->{id}, > } > ); > >@@ -1453,7 +1454,13 @@ sub _send_message_by_email { > from => $from_address, > reply_to => $message->{'reply_address'} || $branch_replyto, > sender => $branch_returnpath, >- subject => "" . $message->{subject} >+ subject => "" . $message->{subject}, >+ ( >+ $message->{letter_id} >+ ? ( template_id => $message->{letter_id} ) >+ : () >+ ), >+ message_id => $message->{id} > }; > > if ( $message->{'content_type'} && $message->{'content_type'} eq SERIALIZED_EMAIL_CONTENT_TYPE ) { >@@ -1464,8 +1471,6 @@ sub _send_message_by_email { > $email->create($params); > } else { > $email = Koha::Email->create($params); >- $email->header('X-Koha-Letter-Id', $message->{letter_id} ); >- $email->header('X-Koha-Message-Id', $message->{id} ); > if ($is_html) { > $email->html_body( _wrap_html( $content, $subject ) ); > } else { >diff --git a/Koha/Email.pm b/Koha/Email.pm >index c7c23e3c1c6..7701b9e4000 100644 >--- a/Koha/Email.pm >+++ b/Koha/Email.pm >@@ -173,11 +173,15 @@ sub create { > $email->header( 'Reply-To', $addresses->{reply_to} ) > if $addresses->{reply_to}; > >- $email->header( 'Sender' => $addresses->{sender} ) if $addresses->{sender}; >+ $email->header( 'Sender' => $addresses->{sender} ) if $addresses->{sender}; > $email->header( 'Content-Type' => $params->{contenttype} ) if $params->{contenttype}; > $email->header( 'X-Mailer' => "Koha" ); > $email->header( 'Message-ID' => Email::MessageID->new->in_brackets ); > >+ # Add Koha message headers to aid later message identification >+ $email->header( 'X-Koha-Template-Id' => $params->{template_id} ) if $params->{template_id}; >+ $email->header( 'X-Koha-Message-Id' => $params->{message_id} ) if $params->{message_id}; >+ > if ( $params->{text_body} ) { > $email->text_body( $params->{text_body}, %{ $params->{body_params} } ); > } >diff --git a/t/Koha/Email.t b/t/Koha/Email.t >index dbd17834baf..a9ff4c3be3c 100755 >--- a/t/Koha/Email.t >+++ b/t/Koha/Email.t >@@ -28,7 +28,7 @@ use_ok('Koha::Email'); > > subtest 'create() tests' => sub { > >- plan tests => 25; >+ plan tests => 27; > > t::lib::Mocks::mock_preference( 'SendAllEmailsTo', undef ); > >@@ -46,6 +46,8 @@ subtest 'create() tests' => sub { > subject => 'Some subject', > html_body => $html_body, > body_params => { charset => 'iso-8859-1' }, >+ template_id => 1, >+ message_id => 1, > } > ); > >@@ -57,6 +59,8 @@ subtest 'create() tests' => sub { > is( $email->email->header('Sender'), 'sender@example.com', 'Value set correctly' ); > is( $email->email->header('Subject'), 'Some subject', 'Value set correctly' ); > is( $email->email->header('X-Mailer'), 'Koha', 'Value set correctly' ); >+ is( $email->email->header('X-Koha-Template-Id'), 1, 'Value set correctly' ); >+ is( $email->email->header('X-Koha-Message-Id'), 1, 'Value set correctly' ); > is( $email->email->body, $html_body, "Body set correctly" ); > like( $email->email->content_type, qr|text/html|, "Content type set correctly"); > like( $email->email->content_type, qr|charset="?iso-8859-1"?|, "Charset set correctly"); >-- >2.45.0
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 31627
:
140998
|
141025
|
142826
|
143022
|
151536
|
151537
|
155364
|
166374
|
166375
|
166376
|
166377
|
166378
|
166379
|
166399
| 166400 |
166401