From a82e0554feef2751156d8b123f878c39a6cd2d41 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Thu, 11 Apr 2024 13:12:58 +0300 Subject: [PATCH] Bug 36313: Fix Undefined subroutine &C4::Circulation::CheckReserves error On (at least) git installations of Koha checkouts and checkins fail on error 500. Logs have following error: Undefined subroutine &C4::Circulation::CheckReserves called... Error happens also when one tries to open patrons checkouts from detail page. Koha doesn't die but table just keeps loading. Solution is to add C4::Reserves before CheckReserves when it's called from Circulation.pm. To test: 1. Apply this patch. 2. Try to check out and check in item. => Confirm both operations are succesfull. 3. Attempt to open patrons checkouts from patron detail and checkout page. => Table should load Also prove t/db_dependent/Circulation.t. Sponsored-by: Koha-Suomi Oy Signed-off-by: BabaJaga Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 80beaf875b3645034f5dda37bfadf51a038859cc) Signed-off-by: Fridolin Somers (cherry picked from commit d26306ed328c1be1c59f33515caa699071a4aacc) Signed-off-by: Lucas Gass --- C4/Circulation.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 281f29f35d..88b52a2f6c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -378,7 +378,7 @@ sub transferbook { # find reserves..... # That'll save a database query. my ( $resfound, $resrec, undef ) = - CheckReserves( $item ); + C4::Reserves::CheckReserves( $item ); if ( $resfound ) { $resrec->{'ResFound'} = $resfound; $messages->{'ResFound'} = $resrec; @@ -1178,7 +1178,7 @@ sub CanBookBeIssued { unless ( $ignore_reserves || $recall ) { # See if the item is on reserve. - my ( $restype, $res ) = CheckReserves( $item_object ); + my ( $restype, $res ) = C4::Reserves::CheckReserves( $item_object ); if ($restype) { my $resbor = $res->{'borrowernumber'}; if ( $resbor ne $patron->borrowernumber ) { @@ -1406,7 +1406,7 @@ sub checkHighHolds { # Remove any items that are not holdable for this patron # We need to ignore hold counts as the borrower's own hold that will be filled by the checkout # could prevent them from placing further holds - @items = grep { CanItemBeReserved( $patron, $_, undef, { ignore_hold_counts => 1 } )->{status} eq 'OK' } @items; + @items = grep { C4::Reserves::CanItemBeReserved( $patron, $_, undef, { ignore_hold_counts => 1 } )->{status} eq 'OK' } @items; my $items_count = scalar @items; @@ -2434,7 +2434,7 @@ sub AddReturn { # launch the Checkreserves routine to find any holds my ($resfound, $resrec); my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds - ($resfound, $resrec, undef) = CheckReserves( $item, $lookahead ) unless ( $item->withdrawn ); + ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item, $lookahead ) unless ( $item->withdrawn ); # if a hold is found and is waiting at another branch, change the priority back to 1 and trigger the hold (this will trigger a transfer and update the hold status properly) if ( $resfound and $resfound eq "Waiting" and $branch ne $resrec->{branchcode} ) { my $hold = C4::Reserves::RevertWaitingStatus( { itemnumber => $item->itemnumber } ); @@ -3040,7 +3040,7 @@ sub CanBookBeRenewed { if ( $item->current_holds->search( { non_priority => 0 } )->count ); - my ( $status, $matched_reserve, $possible_holds ) = CheckReserves($item); + my ( $status, $matched_reserve, $possible_holds ) = C4::Reserves::CheckReserves($item); my @fillable_holds = (); foreach my $possible_hold ( @{$possible_holds} ) { push @fillable_holds, $possible_hold unless $possible_hold->{non_priority}; -- 2.39.5