From ce79e0ce09dd5e7658330db2f31d34b4f0570339 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 6 Oct 2021 12:48:23 +0000 Subject: [PATCH] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn --- C4/Accounts.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index ad0d34f184..a79af6ad12 100644 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -71,7 +71,7 @@ sub chargelostitem { my $dbh = C4::Context->dbh(); my ($borrowernumber, $itemnumber, $amount, $description) = @_; my $itype = Koha::ItemTypes->find({ itemtype => Koha::Items->find($itemnumber)->effective_itemtype() }); - my $replacementprice = $amount; + my $replacementprice = $amount // 0; my $defaultreplacecost = $itype->defaultreplacecost; my $processfee = $itype->processfee; my $usedefaultreplacementcost = C4::Context->preference("useDefaultReplacementCost"); -- 2.20.1