View | Details | Raw Unified | Return to bug 22563
Collapse All | Expand All

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 2373-2379 sub _FixOverduesOnReturn { Link Here
2373
2373
2374
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2374
  &_FixAccountForLostAndReturned($itemnumber, [$borrowernumber, $barcode]);
2375
2375
2376
Calculates the charge for a book lost and returned.
2376
Finds the most recent lost item charge for this item and refunds the borrower
2377
appropriatly, taking into account any payments or writeoffs already applied
2378
against the charge.
2377
2379
2378
Internal function, not exported, called only by AddReturn.
2380
Internal function, not exported, called only by AddReturn.
2379
2381
Lines 2390-2396 sub _FixAccountForLostAndReturned { Link Here
2390
    my $accountlines = Koha::Account::Lines->search(
2392
    my $accountlines = Koha::Account::Lines->search(
2391
        {
2393
        {
2392
            itemnumber  => $itemnumber,
2394
            itemnumber  => $itemnumber,
2393
            accounttype => { -in => [ 'LOST', 'W' ] },
2395
            accounttype => 'LOST',
2396
            status      => [ undef, { '<>' => 'RETURNED' } ]
2394
        },
2397
        },
2395
        {
2398
        {
2396
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
2399
            order_by => { -desc => [ 'date', 'accountlines_id' ] }
Lines 2436-2443 sub _FixAccountForLostAndReturned { Link Here
2436
        $credit->apply( { debits => $accountlines->reset } );
2439
        $credit->apply( { debits => $accountlines->reset } );
2437
    }
2440
    }
2438
2441
2439
    # Manually set the accounttype
2442
    # Update the account status
2440
    $accountline->discard_changes->accounttype('LR');
2443
    $accountline->discard_changes->status('RETURNED');
2441
    $accountline->store;
2444
    $accountline->store;
2442
2445
2443
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
2446
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
(-)a/Koha/Account.pm (-1 / +1 lines)
Lines 709-715 our $offset_type = { Link Here
709
our $account_type_credit = {
709
our $account_type_credit = {
710
    'credit'           => 'C',
710
    'credit'           => 'C',
711
    'forgiven'         => 'FOR',
711
    'forgiven'         => 'FOR',
712
    'lost_item_return' => 'CR',
712
    'lost_item_return' => 'LOST_RETURN',
713
    'payment'          => 'Pay',
713
    'payment'          => 'Pay',
714
    'writeoff'         => 'W'
714
    'writeoff'         => 'W'
715
};
715
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc (-21 / +20 lines)
Lines 1-26 Link Here
1
[%- BLOCK account_type_description -%]
1
[%- BLOCK account_type_description -%]
2
    [%- SWITCH account.accounttype -%]
2
    [%- SWITCH account.accounttype -%]
3
        [%- CASE 'Pay'     -%]<span>Payment, thanks</span>
3
        [%- CASE 'Pay'         -%]<span>Payment, thanks</span>
4
        [%- CASE 'Pay00'   -%]<span>Payment, thanks (cash via SIP2)</span>
4
        [%- CASE 'Pay00'       -%]<span>Payment, thanks (cash via SIP2)</span>
5
        [%- CASE 'Pay01'   -%]<span>Payment, thanks (VISA via SIP2)</span>
5
        [%- CASE 'Pay01'       -%]<span>Payment, thanks (VISA via SIP2)</span>
6
        [%- CASE 'Pay02'   -%]<span>Payment, thanks (credit card via SIP2)</span>
6
        [%- CASE 'Pay02'       -%]<span>Payment, thanks (credit card via SIP2)</span>
7
        [%- CASE 'N'       -%]<span>New card</span>
7
        [%- CASE 'N'           -%]<span>New card</span>
8
        [%- CASE 'OVERDUE' -%]<span>Fine[%- PROCESS account_status_description account=account -%]</span>
8
        [%- CASE 'OVERDUE'     -%]<span>Fine[%- PROCESS account_status_description account=account -%]</span>
9
        [%- CASE 'A'       -%]<span>Account management fee</span>
9
        [%- CASE 'A'           -%]<span>Account management fee</span>
10
        [%- CASE 'M'       -%]<span>Sundry</span>
10
        [%- CASE 'M'           -%]<span>Sundry</span>
11
        [%- CASE 'LOST'    -%]<span>Lost item</span>
11
        [%- CASE 'LOST'        -%]<span>Lost item[%- PROCESS account_status_description account=account -%]</span>
12
        [%- CASE 'W'       -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
12
        [%- CASE 'W'           -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
13
        [%- CASE 'HE'      -%]<span>Hold waiting too long</span>
13
        [%- CASE 'HE'          -%]<span>Hold waiting too long</span>
14
        [%- CASE 'Rent'    -%]<span>Rental fee</span>
14
        [%- CASE 'Rent'        -%]<span>Rental fee</span>
15
        [%- CASE 'FOR'     -%]<span>Forgiven[%- PROCESS account_status_description account=account -%]</span>
15
        [%- CASE 'FOR'         -%]<span>Forgiven[%- PROCESS account_status_description account=account -%]</span>
16
        [%- CASE 'LR'      -%]<span>Lost item fee refund[%- PROCESS account_status_description account=account -%]</span>
16
        [%- CASE 'PF'          -%]<span>Lost item processing fee</span>
17
        [%- CASE 'PF'      -%]<span>Lost item processing fee</span>
17
        [%- CASE 'PAY'         -%]<span>Payment[%- PROCESS account_status_description account=account -%]</span>
18
        [%- CASE 'PAY'     -%]<span>Payment[%- PROCESS account_status_description account=account -%]</span>
18
        [%- CASE 'WO'          -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
19
        [%- CASE 'WO'      -%]<span>Writeoff[%- PROCESS account_status_description account=account -%]</span>
19
        [%- CASE 'C'           -%]<span>Credit[%- PROCESS account_status_description account=account -%]</span>
20
        [%- CASE 'C'       -%]<span>Credit[%- PROCESS account_status_description account=account -%]</span>
20
        [%- CASE 'LOST_RETURN' -%]<span>Lost item fee refund[%- PROCESS account_status_description account=account -%]</span>
21
        [%- CASE 'CR'      -%]<span>Credit[%- PROCESS account_status_description account=account -%]</span>
21
        [%- CASE 'Res'         -%]<span>Hold fee</span>
22
        [%- CASE 'Res'     -%]<span>Hold fee</span>
22
        [%- CASE               -%][% account.accounttype | html %]
23
        [%- CASE           -%][% account.accounttype | html %]
24
    [%- END -%]
23
    [%- END -%]
25
[%- END -%]
24
[%- END -%]
26
25
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt (-1 / +1 lines)
Lines 211-217 Link Here
211
                        <span>Account management fee</span>
211
                        <span>Account management fee</span>
212
                    [% ELSIF loopresul.accounttype == "M" %]
212
                    [% ELSIF loopresul.accounttype == "M" %]
213
                        <span>Sundry</span>
213
                        <span>Sundry</span>
214
                    [% ELSIF loopresul.accounttype == "L" || loopresul.accounttype == "LR" %]
214
                    [% ELSIF loopresul.accounttype == "LOST" %]
215
                        <span>Lost item</span>
215
                        <span>Lost item</span>
216
                    [% ELSIF loopresul.accounttype == "N" %]
216
                    [% ELSIF loopresul.accounttype == "N" %]
217
                        <span>New card</span>
217
                        <span>New card</span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-3 / +2 lines)
Lines 38-54 Link Here
38
                        [% CASE 'OVERDUE' %]Fine[%- PROCESS account_status_description account=account -%]
38
                        [% CASE 'OVERDUE' %]Fine[%- PROCESS account_status_description account=account -%]
39
                        [% CASE 'A' %]Account management fee
39
                        [% CASE 'A' %]Account management fee
40
                        [% CASE 'M' %]Sundry
40
                        [% CASE 'M' %]Sundry
41
                        [% CASE 'LOST' %]Lost item
41
                        [% CASE 'LOST' %]Lost item[%- PROCESS account_status_description account=account -%]
42
                        [% CASE 'W' %]Writeoff[%- PROCESS account_status_description account=account -%]
42
                        [% CASE 'W' %]Writeoff[%- PROCESS account_status_description account=account -%]
43
                        [% CASE 'HE' %]Hold waiting too long
43
                        [% CASE 'HE' %]Hold waiting too long
44
                        [% CASE 'Rent' %]Rental fee
44
                        [% CASE 'Rent' %]Rental fee
45
                        [% CASE 'FOR' %]Forgiven[%- PROCESS account_status_description account=account -%]
45
                        [% CASE 'FOR' %]Forgiven[%- PROCESS account_status_description account=account -%]
46
                        [% CASE 'LR' %]Lost item fee refund[%- PROCESS account_status_description account=account -%]
47
                        [% CASE 'PF' %]Lost item processing fee
46
                        [% CASE 'PF' %]Lost item processing fee
48
                        [% CASE 'PAY' %]Payment[%- PROCESS account_status_description account=account -%]
47
                        [% CASE 'PAY' %]Payment[%- PROCESS account_status_description account=account -%]
49
                        [% CASE 'WO' %]Writeoff[%- PROCESS account_status_description account=account -%]
48
                        [% CASE 'WO' %]Writeoff[%- PROCESS account_status_description account=account -%]
50
                        [% CASE 'C' %]Credit[%- PROCESS account_status_description account=account -%]
49
                        [% CASE 'C' %]Credit[%- PROCESS account_status_description account=account -%]
51
                        [% CASE 'CR' %]Credit[%- PROCESS account_status_description account=account -%]
50
                        [% CASE 'LOST_RETURN' %]Lost item fee refund[%- PROCESS account_status_description account=account -%]
52
                        [%-CASE 'Res' %]Hold fee
51
                        [%-CASE 'Res' %]Hold fee
53
                        [% CASE %][% ACCOUNT_LINE.accounttype | html %]
52
                        [% CASE %][% ACCOUNT_LINE.accounttype | html %]
54
                        [%- END -%]
53
                        [%- END -%]
(-)a/reports/cash_register_stats.pl (-3 / +2 lines)
Lines 118-128 if ($do_it) { Link Here
118
            $row->{date} = dt_from_string($row->{date}, 'sql');
118
            $row->{date} = dt_from_string($row->{date}, 'sql');
119
119
120
            push (@loopresult, $row);
120
            push (@loopresult, $row);
121
            if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^LR$|^Pay$/)){
121
            if($transaction_type eq 'ACT' && ($row->{accounttype} !~ /^C$|^CR$|^Pay$/)){
122
                pop @loopresult;
122
                pop @loopresult;
123
                next;
123
                next;
124
            }
124
            }
125
            if($row->{accounttype} =~ /^C$|^CR$|^LR$/){
125
            if($row->{accounttype} =~ /^C$|^CR$/){
126
                $grantotal -= abs($row->{amount});
126
                $grantotal -= abs($row->{amount});
127
                $row->{amount} = '-' . $row->{amount};
127
                $row->{amount} = '-' . $row->{amount};
128
            }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
128
            }elsif($row->{accounttype} eq 'FORW' || $row->{accounttype} eq 'W'){
129
- 

Return to bug 22563