From 7e850a2e063ca05fbaac599f5044b7e19175618b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 16 Oct 2024 16:45:18 +0100 Subject: [PATCH] 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 --- Koha/Booking.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Booking.pm b/Koha/Booking.pm index f3376af918d..c849c07e9ec 100644 --- a/Koha/Booking.pm +++ b/Koha/Booking.pm @@ -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 } ); -- 2.47.0