Bugzilla – Attachment 79341 Details for
Bug 21196
C4::Overdues::CalcFine should consider default item type replacement cost
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21196: Use replacement cost from the item type if not set at item level
Bug-21196-Use-replacement-cost-from-the-item-type-.patch (text/plain), 2.63 KB, created by
Katrin Fischer
on 2018-09-24 19:43:41 UTC
(
hide
)
Description:
Bug 21196: Use replacement cost from the item type if not set at item level
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-09-24 19:43:41 UTC
Size:
2.63 KB
patch
obsolete
>From 7e9725ed602c1122fc55d4f719a0a52384c86b75 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 13 Aug 2018 12:40:22 -0300 >Subject: [PATCH] Bug 21196: Use replacement cost from the item type if not set > at item level > >When circ rules are set to cap at item replacement cost, calcfine only >checks the price in the item record, not the default replacement cost by >item type. > >Note: We do not take '0' into account, what if you do not want to set >a replacement cost for an item? It is how it is done in chargelostitem >so keeping the existing behaviour, but that may be considered as a bug (?) > >Test plan: >- Set useDefaultReplacementCost to use >- Set a default replacement cost for a given item type >- Create an item of that type with a replacementcost=0 >- Create a circ rule for that item type that accrues fines but caps at >replacement cost >- check the item out, forcing a due date in the past >- check that item in >=> Fines should have been generated > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Overdues.pm | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index f5c5132..1e67b7f 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -240,6 +240,8 @@ sub CalcFine { > my $itemtype = $item->{itemtype} || $item->{itype}; > my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule({ categorycode => $bortype, itemtype => $itemtype, branchcode => $branchcode }); > >+ $itemtype = Koha::ItemTypes->find($itemtype); >+ > return unless $issuing_rule; # If not rule exist, there is no fine > > my $fine_unit = $issuing_rule->lengthunit || 'days'; >@@ -257,7 +259,15 @@ sub CalcFine { > } # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. } > > $amount = $issuing_rule->overduefinescap if $issuing_rule->overduefinescap && $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 >+ && $item->{replacementprice} == 0 >+ && C4::Context->preference("useDefaultReplacementCost"); >+ > $amount = $item->{replacementprice} if ( $issuing_rule->cap_fine_to_replacement_price && $item->{replacementprice} && $amount > $item->{replacementprice} ); >+ > $debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $issuing_rule->chargename, $units_minus_grace, $chargeable_units); > return ($amount, $issuing_rule->chargename, $units_minus_grace, $chargeable_units); > # FIXME: chargename is NEVER populated anywhere. >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21196
:
77758
|
77759
|
79340
| 79341