Bug 37204: (QA follow-up) Consistently pick notice library

We should use the notice from the library that initiated the action that
triggered the notice. This should be available to us always in the
userenv.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Sponsored-by: Büchereizentrale Schleswig-Holstein <https://www.bz-sh.de/>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-10-16 16:45:18 +01:00 committed by Katrin Fischer
parent db8531c58b
commit ffd60727f1
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 8 additions and 4 deletions

View File

@ -160,12 +160,13 @@ sub store {
{
my $patron = $self->patron;
my $pickup_library = $self->pickup_library;
my $branch = C4::Context->userenv->{'branch'};
my $letter = C4::Letters::GetPreparedLetter(
module => 'bookings',
letter_code => 'BOOKING_MODIFICATION',
message_transport_type => 'email',
branchcode => $pickup_library->branchcode,
branchcode => $branch,
lang => $patron->lang,
objects => {
old_booking => $old_booking,
@ -286,6 +287,7 @@ sub to_api_mapping {
sub delete {
my ($self) = @_;
my $branch = C4::Context->userenv->{'branch'};
my $patron = $self->patron;
my $pickup_library = $self->pickup_library;
@ -293,7 +295,7 @@ sub delete {
module => 'bookings',
letter_code => 'BOOKING_CANCELLATION',
message_transport_type => 'email',
branchcode => $pickup_library->branchcode,
branchcode => $branch,
lang => $patron->lang,
objects => { booking => $self }
);

View File

@ -126,7 +126,8 @@ subtest 'store() tests' => sub {
plan tests => 14;
$schema->storage->txn_begin;
my $patron = $builder->build_object( { class => "Koha::Patrons" } );
my $patron = $builder->build_object( { class => "Koha::Patrons" } );
t::lib::Mocks::mock_userenv( { patron => $patron } );
my $biblio = $builder->build_sample_biblio();
my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
my $start_0 = dt_from_string->subtract( days => 2 )->truncate( to => 'day' );
@ -412,7 +413,8 @@ subtest 'delete() tests' => sub {
$schema->storage->txn_begin;
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
t::lib::Mocks::mock_userenv( { patron => $patron } );
my $biblio = $builder->build_sample_biblio;
my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
my $start_0 = dt_from_string->subtract( days => 2 )->truncate( to => 'day' );