From 478ffeae6030bc774f8b752b3c19e75879a3bad9 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 22 Mar 2021 13:29:13 +0000 Subject: [PATCH] Bug 27032: (follow-up) Pass rather than fetch variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nick Clemens Rebased-by: Joonas Kylmälä Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- C4/Circulation.pm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 31cd75b22d..11c3c7713d 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2786,7 +2786,12 @@ sub CanBookBeRenewed { return ( 0, 'overdue'); } - $auto_renew = _CanBookBeAutoRenewed($borrowernumber, $itemnumber); + $auto_renew = _CanBookBeAutoRenewed({ + patron => $patron, + item => $item, + branchcode => $branchcode, + issue => $issue + }); return ( 0, $auto_renew ) if $auto_renew =~ 'auto_account_expired'; return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_late'; return ( 0, $auto_renew ) if $auto_renew =~ 'auto_too_much_oweing'; @@ -4238,12 +4243,11 @@ sub _CalculateAndUpdateFine { } sub _CanBookBeAutoRenewed { - my ( $borrowernumber, $itemnumber ) = @_; - - my $item = Koha::Items->find($itemnumber); - my $issue = $item->checkout; - my $patron = $issue->patron; - my $branchcode = _GetCircControlBranch( $item->unblessed, $patron->unblessed ); + my ( $params ) = @_; + my $patron = $params->{patron}; + my $item = $params->{item}; + my $branchcode = $params->{branchcode}; + my $issue = $params->{issue}; my $issuing_rule = Koha::CirculationRules->get_effective_rules( { -- 2.39.5