From 3896c6e8db39b115bb61284e8b4b14cefc9c1728 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 23 Feb 2022 16:28:58 +0000 Subject: [PATCH] Bug 30168: Embed patron and item in issue for passing to GetSoonestRenewDate --- C4/Circulation.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 26e176d99c..2108b5e340 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2753,8 +2753,8 @@ sub CanBookBeRenewed { my $auto_renew = "no"; my $soonest; - my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); - my $issue = $item->checkout or return ( 0, 'no_checkout' ); + my $issue = Koha::Checkouts->find({ itemnumber => $itemnumber }, { prefetch => ['borrowernumber','itemnumber'] }) or return ( 0, 'no_issue' ); + my $item = $issue->item or return ( 0, 'no_item' ); return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); -- 2.30.2