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> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
aed4a2ec98
commit
298abcb4cb
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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} } );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue