Bugzilla – Attachment 127018 Details for
Bug 20262
Add ability to refund lost item fees without creating credits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20262: Add ability to refund lost item fees without creating credits
Bug-20262-Add-ability-to-refund-lost-item-fees-wit.patch (text/plain), 11.80 KB, created by
David Gustafsson
on 2021-10-27 15:58:57 UTC
(
hide
)
Description:
Bug 20262: Add ability to refund lost item fees without creating credits
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2021-10-27 15:58:57 UTC
Size:
11.80 KB
patch
obsolete
>From 667a96b9b8aaa8426a5dcf54a01f3035730dbfcc Mon Sep 17 00:00:00 2001 >From: Stefan Berndtsson <stefan.berndtsson@ub.gu.se> >Date: Thu, 30 Sep 2021 15:11:59 +0200 >Subject: [PATCH] Bug 20262: Add ability to refund lost item fees without > creating credits > >Some libraries handle refunding of paid lost fees at a financial office and not within Koha. To facilitate this, it would be good for Koha to have the option to not generate lost returned credits by skipping fully paid lost items, and only refunding the outstanding balance on partially paid lost fees. > >Test Plan: >1) Apply this patch >2) Set your lost item refund on return policies to 'Only if unpaid' >3) Mark an item lost, charging the lost fee >4) Return the item, a full refund should ocurr >5) Mark another item lost, charging the lost fee >6) Make a partial payment on this lost fee >7) Return the item >8) The remaining balance of that fee should be 0, but the patron should > not recieve a credit for the already paid balance >8) Mark another item lost, charging the lost fee >9) Fully pay the lost fee >10) Return the item. The paid lost fee should be unaffected. >--- > Koha/Item.pm | 29 ++++++++++++++----- > .../prog/en/modules/admin/smart-rules.tt | 24 +++++++++++++++ > 2 files changed, 45 insertions(+), 8 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 60d80a5c3e..2ffbdbfdac 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -997,14 +997,26 @@ sub _set_found_trigger { > if ( $patron ) { > > my $account = $patron->account; >- my $total_to_refund = 0; > >- # Use cases >- if ( $lost_charge->amount > $lost_charge->amountoutstanding ) { >+ # Credit outstanding amount >+ my $credit_total = $lost_charge->amountoutstanding; > >+ # Use cases >+ if ( >+ $lost_charge->amount > $lost_charge->amountoutstanding && >+ $lostreturn_policy ne "refund_unpaid" >+ ) { > # some amount has been cancelled. collect the offsets that are not writeoffs > # this works because the only way to subtract from this kind of a debt is > # using the UI buttons 'Pay' and 'Write off' >+ >+ # We don't credit any payments if return policy is >+ # "refund_unpaid" >+ # >+ # In that case only unpaid/outstanding amount >+ # will be credited wich settles the debt without >+ # creating extra credits >+ > my $credit_offsets = $lost_charge->debit_offsets( > { > 'credit_id' => { '!=' => undef }, >@@ -1013,13 +1025,14 @@ sub _set_found_trigger { > { join => 'credit' } > ); > >- $total_to_refund = ( $credit_offsets->count > 0 ) >- ? $credit_offsets->total * -1 # credits are negative on the DB >- : 0; >+ my $total_to_refund = ( $credit_offsets->count > 0 ) >+ ? $credit_offsets->total * -1 # credits are negative on the DB >+ : 0; >+ # Credit the outstanding amount, then add what has been >+ # paid to create a net credit for this amount >+ $credit_total += $total_to_refund; > } > >- my $credit_total = $lost_charge->amountoutstanding + $total_to_refund; >- > my $credit; > if ( $credit_total > 0 ) { > my $branchcode = >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 172e546f8a..97c968f0ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -810,26 +810,37 @@ > [% IF ( current_branch == '*' ) %] > [% IF ( defaultRefundRule == 'refund' ) %] > <option value="refund" selected="selected">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> >+ <option value="charge">Refund lost item charge and charge new overdue fine</option> >+ <option value="restore">Refund lost item charge and restore overdue fine</option> >+ <option value="0">Leave lost item charge</option> >+ [% ELSIF ( defaultRefundRule == 'refund_unpaid' ) %] >+ <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSIF ( defaultRefundRule == 'charge' ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSIF ( defaultRefundRule == 'restore' ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSIF ( defaultRefundRule == 0 ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0" selected="selected">Leave lost item charge</option> > [% ELSE %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> >@@ -843,6 +854,8 @@ > [% END %] > [% IF defaultRefundRule == 'refund' %] > Use default (Refund lost item charge) >+ [% ELSIF defaultRefundRule == 'refund_unpaid' %] >+ Use default (Refund lost item charge (only if unpaid)) > [% ELSIF defaultRefundRule == 'charge' %] > Use default (Refund lost item charge and restore overdue fine) > [% ELSIF defaultRefundRule == 'restore' %] >@@ -853,27 +866,38 @@ > </option> > [% IF ( not refundLostItemFeeRule ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSE %] > [% IF ( refundLostItemFeeRule.rule_value == 'refund' ) %] > <option value="refund" selected="selected">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> >+ [% ELSIF ( refundLostItemFeeRule.rule_value == 'refund_unpaid' ) %] >+ <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid" selected="selected">Refund lost item charge (only if unpaid)</option> >+ <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option> >+ <option value="restore">Refund lost item charge and restore overdue fine</option> >+ <option value="0">Leave lost item charge</option> > [% ELSIF ( refundLostItemFeeRule.rule_value == 'charge' ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge" selected="selected">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSIF ( refundLostItemFeeRule.rule_value == 'restore' ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore" selected="selected">Refund lost item charge and restore overdue fine</option> > <option value="0">Leave lost item charge</option> > [% ELSIF ( refundLostItemFeeRule.rule_value == 0 ) %] > <option value="refund">Refund lost item charge</option> >+ <option value="refund_unpaid">Refund lost item charge (only if unpaid)</option> > <option value="charge">Refund lost item charge and charge new overdue fine</option> > <option value="restore">Refund lost item charge and restore overdue fine</option> > <option value="0" selected="selected">Leave lost item charge</option> >-- >2.20.1
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 20262
:
72029
|
72030
|
75470
|
75503
|
75532
|
94099
|
127018
|
127285
|
127286
|
134555
|
136006
|
136007
|
139543
|
139544
|
139545