From 85db12d66819b589a8c47ed8333fd3b188423c0f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Dec 2019 10:50:43 +0100 Subject: [PATCH] Bug 24259: Handle non existing default circ rule in Charges::Fees Can't call method "lengthunit" on an undefined value at /usr/share/koha/lib/Koha/Charges/Fees.pm line 101. Test plan: 1 - Remove all/all rule form circulation rules 2 - Define a rental fee per day for an itemtype 3 - Checkout an item of this type ot patron 4 - Should get note of no circ rule defined 5 - Confirm the checkout => item is checked out Signed-off-by: hc Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson (cherry picked from commit 3d9e1e4603a1371d44868c42f4b7a29c58b5c20f) Signed-off-by: Lucas Gass --- Koha/Charges/Fees.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm index 41299cee14..becd9b5c9b 100644 --- a/Koha/Charges/Fees.pm +++ b/Koha/Charges/Fees.pm @@ -98,6 +98,8 @@ sub accumulate_rentalcharge { branchcode => $self->library->id } ); + return 0 unless $issuing_rule; + my $units = $issuing_rule->lengthunit; my $rentalcharge_increment = ( $units eq 'days' ) ? $itemtype->rentalcharge_daily : $itemtype->rentalcharge_hourly; -- 2.39.5