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 <hc@interleaf.ie>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-12-18 10:50:43 +01:00 committed by Martin Renvoize
parent 5b58cee945
commit 5432cbd92a
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 0 deletions

View File

@ -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' )