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

(-)a/Koha/ArticleRequest.pm (-1 / +28 lines)
Lines 138-143 sub cancel { Link Here
138
    $self->notes($notes) if $notes;
138
    $self->notes($notes) if $notes;
139
    $self->store();
139
    $self->store();
140
    $self->notify();
140
    $self->notify();
141
142
    my $debit = $self->debit;
143
144
    if ( $debit ) {
145
        # fees found, refund
146
        my $account = $self->borrower->account;
147
148
        my $total_reversible = $debit->debit_offsets->filter_by_reversible->total;
149
        if ( $total_reversible ) {
150
151
            $account->add_credit(
152
                {
153
                    amount       => abs $total_reversible,
154
                    interface    => C4::Context->interface,
155
                    type         => 'REFUND',
156
                }
157
            );
158
        }
159
160
        if ( $debit->amountoutstanding ) {
161
            $debit->reduce({
162
                reduction_type => 'REFUND',
163
                amount         => $debit->amountoutstanding,
164
                interface      => C4::Context->interface,
165
            })->discard_changes;
166
        }
167
    }
168
141
    return $self;
169
    return $self;
142
}
170
}
143
171
144
- 

Return to bug 29759