From 607e322ade2e560d2ac4e602fcbbf44239da5637 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 28 May 2025 03:47:42 +0000 Subject: [PATCH] Bug 39962: Allocate checkout item to current recalls 1. Set up a recall before applying both of these patches 2. Apply the first patch and notice that the recall still doesn't show, because it was created before the patch was applied 3. Apply this patch, install database updates and restart services 4. Notice your old recall now shows as requested and was allocated the relevant checkout item Sponsored-by: Auckland University of Technology --- Koha/Recall.pm | 2 +- ..._-_allocate_item_id_to_biblevel_recalls.pl | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_39962_-_allocate_item_id_to_biblevel_recalls.pl diff --git a/Koha/Recall.pm b/Koha/Recall.pm index 1b25f0a78f8..8a4834d3158 100644 --- a/Koha/Recall.pm +++ b/Koha/Recall.pm @@ -118,7 +118,7 @@ sub checkout { foreach (@items) { my $recalls_allowed = Koha::CirculationRules->get_effective_rule( { - branchcode => C4::Context->userenv->{'branch'}, + branchcode => $self->pickup_library_id, categorycode => $self->patron->categorycode, itemtype => $_->effective_itemtype, rule_name => 'recalls_allowed', diff --git a/installer/data/mysql/atomicupdate/bug_39962_-_allocate_item_id_to_biblevel_recalls.pl b/installer/data/mysql/atomicupdate/bug_39962_-_allocate_item_id_to_biblevel_recalls.pl new file mode 100755 index 00000000000..d1444e443ea --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39962_-_allocate_item_id_to_biblevel_recalls.pl @@ -0,0 +1,24 @@ +use Modern::Perl; +use Koha::Recalls; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "39962", + description => "Recalled status does not show properly on staff interface record detail page", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my @recalls = Koha::Recalls->search( + { status => [ 'requested', 'overdue' ], item_id => undef, item_level => 0, completed => 0 } )->as_list; + foreach my $r (@recalls) { + if ( $r->checkout ) { + my $item_id = $r->checkout->itemnumber; + $r->update( { item_id => $item_id } ); + } + } + + say_success( $out, "Allocated checkout itemnumber to biblio-level recalls" ); + }, +}; + -- 2.39.5