Browse Source

Bug 22563: Update lost handling to use accountline.status

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Martin Renvoize 4 years ago
parent
commit
b954dce9dd
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 9
      C4/Circulation.pm
  2. 2
      Koha/Account.pm
  3. 41
      koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
  4. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt
  5. 4
      reports/cash_register_stats.pl

9
C4/Circulation.pm

@ -2390,7 +2390,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.
@ -2408,6 +2410,7 @@ sub _FixAccountForLostAndReturned {
{
itemnumber => $itemnumber,
accounttype => 'LOST',
status => [ undef, { '<>' => 'RETURNED' } ]
},
{
order_by => { -desc => [ 'date', 'accountlines_id' ] }
@ -2458,8 +2461,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 } );

2
Koha/Account.pm

@ -721,7 +721,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'
};

41
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc

@ -1,26 +1,25 @@
[%- 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 -%]

2
koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt

@ -211,7 +211,7 @@
<span>Account management fee</span>
[% ELSIF loopresul.accounttype == "M" %]
<span>Sundry</span>
[% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %]
[% ELSIF loopresul.accounttype == "LOST" %]
<span>Lost item</span>
[% ELSIF loopresul.accounttype == "N" %]
<span>New card</span>

4
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'){

Loading…
Cancel
Save