@@ -, +, @@
---
C4/Circulation.pm | 11 +++--
Koha/Account.pm | 2 +-
.../prog/en/includes/accounts.inc | 41 +++++++++----------
.../en/modules/reports/cash_register_stats.tt | 2 +-
.../bootstrap/en/includes/account-table.inc | 5 +--
reports/cash_register_stats.pl | 4 +-
6 files changed, 33 insertions(+), 32 deletions(-)
--- a/C4/Circulation.pm
+++ a/C4/Circulation.pm
@@ -2373,7 +2373,9 @@ sub _FixOverduesOnReturn {
&_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
-Calculates the charge for a book lost and returned.
+Finds the most recent lost item charge for this item and refunds the borrower
+appropriatly, taking into account any payments or writeoffs already applied
+against the charge.
Internal function, not exported, called only by AddReturn.
@@ -2390,7 +2392,8 @@ sub _FixAccountForLostAndReturned {
my $accountlines = Koha::Account::Lines->search(
{
itemnumber => $itemnumber,
- accounttype => { -in => [ 'LOST', 'W' ] },
+ accounttype => 'LOST',
+ status => [ undef, { '<>' => 'RETURNED' } ]
},
{
order_by => { -desc => [ 'date', 'accountlines_id' ] }
@@ -2436,8 +2439,8 @@ sub _FixAccountForLostAndReturned {
$credit->apply( { debits => $accountlines->reset } );
}
- # Manually set the accounttype
- $accountline->discard_changes->accounttype('LR');
+ # Update the account status
+ $accountline->discard_changes->status('RETURNED');
$accountline->store;
ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
--- a/Koha/Account.pm
+++ a/Koha/Account.pm
@@ -709,7 +709,7 @@ our $offset_type = {
our $account_type_credit = {
'credit' => 'C',
'forgiven' => 'FOR',
- 'lost_item_return' => 'CR',
+ 'lost_item_return' => 'LOST_RETURN',
'payment' => 'Pay',
'writeoff' => 'W'
};
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
@@ -1,26 +1,25 @@
[%- BLOCK account_type_description -%]
[%- SWITCH account.accounttype -%]
- [%- CASE 'Pay' -%]Payment, thanks
- [%- CASE 'Pay00' -%]Payment, thanks (cash via SIP2)
- [%- CASE 'Pay01' -%]Payment, thanks (VISA via SIP2)
- [%- CASE 'Pay02' -%]Payment, thanks (credit card via SIP2)
- [%- CASE 'N' -%]New card
- [%- CASE 'OVERDUE' -%]Fine[%- PROCESS account_status_description account=account -%]
- [%- CASE 'A' -%]Account management fee
- [%- CASE 'M' -%]Sundry
- [%- CASE 'LOST' -%]Lost item
- [%- CASE 'W' -%]Writeoff[%- PROCESS account_status_description account=account -%]
- [%- CASE 'HE' -%]Hold waiting too long
- [%- CASE 'Rent' -%]Rental fee
- [%- CASE 'FOR' -%]Forgiven[%- PROCESS account_status_description account=account -%]
- [%- CASE 'LR' -%]Lost item fee refund[%- PROCESS account_status_description account=account -%]
- [%- CASE 'PF' -%]Lost item processing fee
- [%- CASE 'PAY' -%]Payment[%- PROCESS account_status_description account=account -%]
- [%- CASE 'WO' -%]Writeoff[%- PROCESS account_status_description account=account -%]
- [%- CASE 'C' -%]Credit[%- PROCESS account_status_description account=account -%]
- [%- CASE 'CR' -%]Credit[%- PROCESS account_status_description account=account -%]
- [%- CASE 'Res' -%]Hold fee
- [%- CASE -%][% account.accounttype | html %]
+ [%- CASE 'Pay' -%]Payment, thanks
+ [%- CASE 'Pay00' -%]Payment, thanks (cash via SIP2)
+ [%- CASE 'Pay01' -%]Payment, thanks (VISA via SIP2)
+ [%- CASE 'Pay02' -%]Payment, thanks (credit card via SIP2)
+ [%- CASE 'N' -%]New card
+ [%- CASE 'OVERDUE' -%]Fine[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'A' -%]Account management fee
+ [%- CASE 'M' -%]Sundry
+ [%- CASE 'LOST' -%]Lost item[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'W' -%]Writeoff[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'HE' -%]Hold waiting too long
+ [%- CASE 'Rent' -%]Rental fee
+ [%- CASE 'FOR' -%]Forgiven[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'PF' -%]Lost item processing fee
+ [%- CASE 'PAY' -%]Payment[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'WO' -%]Writeoff[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'C' -%]Credit[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'LOST_RETURN' -%]Lost item fee refund[%- PROCESS account_status_description account=account -%]
+ [%- CASE 'Res' -%]Hold fee
+ [%- CASE -%][% account.accounttype | html %]
[%- END -%]
[%- END -%]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
@@ -211,7 +211,7 @@
Account management fee
[% ELSIF loopresul.accounttype == "M" %]
Sundry
- [% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %]
+ [% ELSIF loopresul.accounttype == "LOST" %]
Lost item
[% ELSIF loopresul.accounttype == "N" %]
New card
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
@@ -38,17 +38,16 @@
[% CASE 'OVERDUE' %]Fine[%- PROCESS account_status_description account=account -%]
[% CASE 'A' %]Account management fee
[% CASE 'M' %]Sundry
- [% CASE 'LOST' %]Lost item
+ [% CASE 'LOST' %]Lost item[%- PROCESS account_status_description account=account -%]
[% CASE 'W' %]Writeoff[%- PROCESS account_status_description account=account -%]
[% CASE 'HE' %]Hold waiting too long
[% CASE 'Rent' %]Rental fee
[% CASE 'FOR' %]Forgiven[%- PROCESS account_status_description account=account -%]
- [% CASE 'LR' %]Lost item fee refund[%- PROCESS account_status_description account=account -%]
[% CASE 'PF' %]Lost item processing fee
[% CASE 'PAY' %]Payment[%- PROCESS account_status_description account=account -%]
[% CASE 'WO' %]Writeoff[%- PROCESS account_status_description account=account -%]
[% CASE 'C' %]Credit[%- PROCESS account_status_description account=account -%]
- [% CASE 'CR' %]Credit[%- PROCESS account_status_description account=account -%]
+ [% CASE 'LOST_RETURN' %]Lost item fee refund[%- PROCESS account_status_description account=account -%]
[%-CASE 'Res' %]Hold fee
[% CASE %][% ACCOUNT_LINE.accounttype | html %]
[%- END -%]
--- a/reports/cash_register_stats.pl
+++ a/reports/cash_register_stats.pl
@@ -118,11 +118,11 @@ if ($do_it) {
$row->{date} = dt_from_string($row->{date}, 'sql');
push (@loopresult, $row);
- if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){
+ if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^Pay$/)){
pop @loopresult;
next;
}
- if($row->{accounttype} =~ /^C$|^CR$|^LR$/){
+ if($row->{accounttype} =~ /^C$|^CR$/){
$grantotal -= abs($row->{amount});
$row->{amount} = '-' . $row->{amount};
}elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
--