&_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.
{
itemnumber => $itemnumber,
accounttype => 'LOST',
+ status => [ undef, { '<>' => 'RETURNED' } ]
},
{
order_by => { -desc => [ 'date', 'accountlines_id' ] }
$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 } );
[%- BLOCK account_type_description -%]
[%- SWITCH account.accounttype -%]
- [%- CASE 'Pay' -%]<span>Payment
- [%- CASE 'Pay00' -%]<span>Payment (cash via SIP2)
- [%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2)
- [%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2)
- [%- CASE 'N' -%]<span>New card
- [%- CASE 'OVERDUE' -%]<span>Fine
- [%- CASE 'A' -%]<span>Account management fee
- [%- CASE 'M' -%]<span>Sundry
- [%- CASE 'LOST' -%]<span>Lost item
- [%- CASE 'W' -%]<span>Writeoff
- [%- CASE 'HE' -%]<span>Hold waiting too long
- [%- CASE 'Rent' -%]<span>Rental fee
- [%- CASE 'FOR' -%]<span>Forgiven
- [%- CASE 'LR' -%]<span>Lost item fee refund
- [%- CASE 'PF' -%]<span>Lost item processing fee
- [%- CASE 'PAY' -%]<span>Payment
- [%- CASE 'WO' -%]<span>Writeoff
- [%- CASE 'C' -%]<span>Credit
- [%- CASE 'CR' -%]<span>Credit
- [%- CASE 'Res' -%]<span>Hold fee
- [%- CASE -%]<span>[% account.accounttype | html %]
+ [%- CASE 'Pay' -%]<span>Payment
+ [%- CASE 'Pay00' -%]<span>Payment (cash via SIP2)
+ [%- CASE 'Pay01' -%]<span>Payment (VISA via SIP2)
+ [%- CASE 'Pay02' -%]<span>Payment (credit card via SIP2)
+ [%- CASE 'N' -%]<span>New card
+ [%- CASE 'OVERDUE' -%]<span>Fine
+ [%- CASE 'A' -%]<span>Account management fee
+ [%- CASE 'M' -%]<span>Sundry
+ [%- CASE 'LOST' -%]<span>Lost item
+ [%- CASE 'W' -%]<span>Writeoff
+ [%- CASE 'HE' -%]<span>Hold waiting too long
+ [%- CASE 'Rent' -%]<span>Rental fee
+ [%- CASE 'FOR' -%]<span>Forgiven
+ [%- CASE 'PF' -%]<span>Lost item processing fee
+ [%- CASE 'PAY' -%]<span>Payment
+ [%- CASE 'WO' -%]<span>Writeoff
+ [%- CASE 'C' -%]<span>Credit
+ [%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund
+ [%- CASE 'Res' -%]<span>Hold fee
+ [%- CASE -%]<span>[% account.accounttype | html %]
[%- END -%]
[%- PROCESS account_status_description account=account -%]</span>
[%- END -%]
$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'){