From 5776f28efa094e2cdd0dd441ae58be09068cb49a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Oct 2024 16:37:36 +0100 Subject: [PATCH] Bug 38303: Set item's replacement price to defaultreplacecost if 0.00 No idea if this is a real bug. This code is fixing the following test failure: t/db_dependent/Circulation/CalcFine.t .. 1/7 # Failed test 'Amount is calculated correctly' # at t/db_dependent/Circulation/CalcFine.t line 271. # got: '0' # expected: '6' # Looks like you failed 1 test of 2. Signed-off-by: David Nind Signed-off-by: Aleisha Amohia Signed-off-by: Katrin Fischer --- C4/Overdues.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index a2494f7f1e..7faa2e9f21 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -288,10 +288,12 @@ sub CalcFine { && $amount > $issuing_rule->{overduefinescap}; # This must be moved to Koha::Item (see also similar code in C4::Accounts::chargelostitem - $item->{replacementprice} ||= $itemtype->defaultreplacecost - if $itemtype - && ( ! defined $item->{replacementprice} || $item->{replacementprice} == 0 ) - && C4::Context->preference("useDefaultReplacementCost"); + if ( $itemtype + && ( !defined $item->{replacementprice} || $item->{replacementprice} + .0 == 0 ) + && C4::Context->preference("useDefaultReplacementCost") ) + { + $item->{replacementprice} = $itemtype->defaultreplacecost; + } $amount = $item->{replacementprice} if ( $issuing_rule->{cap_fine_to_replacement_price} && $item->{replacementprice} && $amount > $item->{replacementprice} ); -- 2.39.5