Bug 38777: Use branch reply to for HOLD messages

When sending a notice of a hold ready for pickup (not digest) we use the library where the hold is at.

We should also use this when setting the reply to.

To test:
1 - Set the email/replyto for a patron's library to be:
    patron@example.com
2 - Set the email/replyto for another branch to be:
    holdbranch@example.com
3 - Place a hold for the patron for pickup at the other branch
4 - Check in and set hold waiting
5 - SELECT * FROM message_queue
6 - Note the message is from the hold branch, but has a null replyto
    This means we will use patron branch when sending
7 - Apply patch
8 - Revert hold waiting status
9 - Checkin and confirm hold again
10  -Check message queue
11 - Hold now has reply address of branch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2024-12-23 16:05:03 +00:00 committed by Katrin Fischer
parent 04dbbcc2f2
commit 723ed39c2a
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 12 additions and 5 deletions

View File

@ -1776,8 +1776,9 @@ sub _koha_notify_reserve {
message_name => 'Hold_Filled'
} );
my $library = Koha::Libraries->find( $hold->branchcode );
my $from_email_address = $library->from_email_address;
my $library = Koha::Libraries->find( $hold->branchcode );
my $from_email_address = $library->from_email_address;
my $reply_email_address = $library->inbound_email_address;
my %letter_params = (
module => 'reserves',
@ -1812,6 +1813,7 @@ sub _koha_notify_reserve {
letter => $letter,
borrowernumber => $borrowernumber,
from_address => $from_email_address,
reply_address => $reply_email_address,
message_transport_type => $mtt,
}
);

View File

@ -715,7 +715,7 @@ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
subtest '_koha_notify_reserve() tests' => sub {
plan tests => 3;
plan tests => 4;
my $branch = $builder->build_object({
class => 'Koha::Libraries',
@ -797,9 +797,14 @@ subtest '_koha_notify_reserve() tests' => sub {
borrowernumber => $hold_borrower,
})->next();
my $email_to_address = $email->to_address();
is($email_to_address, undef ,"We should not populate the hold message with the email address, sending will do so");
is(
$email_to_address, undef,
"We should not populate the hold message with the email address, sending will do so"
);
my $email_from_address = $email->from_address();
is($email_from_address,'branch@e.mail',"Library's from address is used for sending");
is( $email_from_address, 'branch@e.mail', "Library's from address is used for sending" );
my $email_reply_address = $email->reply_address();
is( $email_reply_address, 'branch@reply.to', "Library's reply address is used for reply" );
};