From 2926c17c7ba6fb865596381338ec8c049b0bb367 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 31 Aug 2021 07:37:43 -0400 Subject: [PATCH] Bug 22866: Allow override of renewals denied by ItemsDeniedRenewal Test Plan: 1) Create a circ rule for patron category Y and itemtype X 2) Block renewal of itemtype X using ItemsDeniedRenewal 3) Confirm AllowRenewalLimitOverride is set to Allow 4) Check item of itemtype X out to patron of category Y 5) See that circulation.pl shows "renewal denied by syspref" 6) Click the checkbox for "Override renewal limit" 7) See that "renewal denied by syspref" message is replaced by a checkbox suggesting renewal will be allowed 8) Attempt to renew item 9) See error "Renew failed: item_denied_renewal" 10) Apply this patch 11) Restart all the things! 12) Attempt to renew the item via override again 13) The renewal is a success! Signed-off-by: Andrew Fuerste-Henry --- svc/renew | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/svc/renew b/svc/renew index a3edd4db43..39f3d3d5be 100755 --- a/svc/renew +++ b/svc/renew @@ -61,8 +61,18 @@ $data->{branchcode} = $branchcode; ( $data->{renew_okay}, $data->{error} ) = CanBookBeRenewed( $borrowernumber, $itemnumber, $override_limit ); +my $override = + $data->{error} + && $data->{error} eq 'on_reserve' + && C4::Context->preference('AllowRenewalOnHoldOverride'); + +$override ||= + $data->{error} + && $data->{error} eq 'item_denied_renewal' + && C4::Context->preference('AllowRenewalLimitOverride'); + # If we're allowing reserved items to be renewed... -if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride')) { +if ( $override ) { $data->{renew_okay} = 1; $data->{error} = undef; } -- 2.20.1