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 <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-10-30 16:37:36 +01:00 committed by Katrin Fischer
parent 593cd04f1e
commit 5776f28efa
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 6 additions and 4 deletions

View File

@ -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} );