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

(-)a/Koha/Account.pm (-18 lines)
Lines 24-30 use Data::Dumper; Link Here
24
use List::MoreUtils qw( uniq );
24
use List::MoreUtils qw( uniq );
25
use Try::Tiny;
25
use Try::Tiny;
26
26
27
use C4::Circulation qw( ReturnLostItem );
28
use C4::Letters;
27
use C4::Letters;
29
use C4::Log qw( logaction );
28
use C4::Log qw( logaction );
30
use C4::Stats qw( UpdateStats );
29
use C4::Stats qw( UpdateStats );
Lines 114-128 sub pay { Link Here
114
        $fine->amountoutstanding($new_amountoutstanding)->store();
113
        $fine->amountoutstanding($new_amountoutstanding)->store();
115
        $balance_remaining = $balance_remaining - $amount_to_pay;
114
        $balance_remaining = $balance_remaining - $amount_to_pay;
116
115
117
        # Same logic exists in Koha::Account::Line::apply
118
        if (   $new_amountoutstanding == 0
119
            && $fine->itemnumber
120
            && $fine->debit_type_code
121
            && ( $fine->debit_type_code eq 'LOST' ) )
122
        {
123
            C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
124
        }
125
126
        my $account_offset = Koha::Account::Offset->new(
116
        my $account_offset = Koha::Account::Offset->new(
127
            {
117
            {
128
                debit_id => $fine->id,
118
                debit_id => $fine->id,
Lines 174-187 sub pay { Link Here
174
        $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay );
164
        $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay );
175
        $fine->store();
165
        $fine->store();
176
166
177
        if (   $fine->amountoutstanding == 0
178
            && $fine->itemnumber
179
            && $fine->debit_type_code
180
            && ( $fine->debit_type_code eq 'LOST' ) )
181
        {
182
            C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber );
183
        }
184
185
        my $account_offset = Koha::Account::Offset->new(
167
        my $account_offset = Koha::Account::Offset->new(
186
            {
168
            {
187
                debit_id => $fine->id,
169
                debit_id => $fine->id,
(-)a/Koha/Account/Line.pm (-11 lines)
Lines 482-497 sub apply { Link Here
482
482
483
            $self->amountoutstanding( $available_credit * -1 )->store;
483
            $self->amountoutstanding( $available_credit * -1 )->store;
484
            $debit->amountoutstanding( $owed - $amount_to_cancel )->store;
484
            $debit->amountoutstanding( $owed - $amount_to_cancel )->store;
485
486
            # Same logic exists in Koha::Account::pay
487
            if (   $debit->amountoutstanding == 0
488
                && $debit->itemnumber
489
                && $debit->debit_type_code
490
                && $debit->debit_type_code eq 'LOST' )
491
            {
492
                C4::Circulation::ReturnLostItem( $self->borrowernumber, $debit->itemnumber );
493
            }
494
495
        }
485
        }
496
    });
486
    });
497
487
498
- 

Return to bug 24474