From 5432cbd92a85513e68f65fede2b4d31f078f1cfa 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 --- Koha/Charges/Fees.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm index 42847983f4..9098a29cd0 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' ) -- 2.39.5