From b9dd6db6a30389813f77d643d6808a08129937e1 Mon Sep 17 00:00:00 2001 From: Hayley Mapley Date: Tue, 20 Aug 2019 05:02:14 +0000 Subject: [PATCH] Bug 8367: Fixes to make the reserves workflow work with new schema Sponsored-by: Brimbank library, Australia --- C4/Circulation.pm | 1 + C4/Reserves.pm | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 44f94e7fec7..23fb6ec5b7d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2058,6 +2058,7 @@ sub AddReturn { # if we don't have a reserve with the status W, we launch the Checkreserves routine my ($resfound, $resrec); my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds + ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->itemnumber, undef, $lookahead ) unless ( $item->withdrawn ); if ($resfound) { $resrec->{'ResFound'} = $resfound; diff --git a/C4/Reserves.pm b/C4/Reserves.pm index bfecb16d4c8..f6b3eb01eae 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -186,7 +186,7 @@ sub AddReserve { } my ($waitingdate, $lastpickupdate); - my $item = C4::Items::GetItem( $checkitem ); + my $item = Koha::Items->find( $checkitem ); #FIXME Prevent bad calls # If the reserv had the waiting status, we had the value of the resdate if ( $found eq 'W' ) { $waitingdate = $resdate; @@ -897,8 +897,9 @@ sub CheckReserves { my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype); next if ($branchitemrule->{'holdallowed'} == 0); next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode)); - my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy}; - next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); + my $hold_fulfillment_policy = $branchitemrule->{'hold_fulfillment_policy'}; + + next if ( ($branchitemrule->{'hold_fulfillment_policy'} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) ); next unless $item->can_be_transferred( { to => scalar Koha::Libraries->find( $res->{branchcode} ) } ); $priority = $res->{'priority'}; $highest = $res; @@ -1198,7 +1199,7 @@ sub ModReserveAffect { $hold->itemnumber($itemnumber); $hold->set_waiting($transferToDo); - my $item = C4::Items::GetItem( $itemnumber ); + my $item = Koha::Items->find( $itemnumber ); my $borrower = Koha::Patrons->find( $borrowernumber ); $borrower = $borrower->unblessed; my $lastpickupdate = GetLastPickupDate( $hold, $item, $borrower ); -- 2.11.0