}
my $patron = Koha::Patrons->find( $self->{patron_id} );
- my @account_offsets = $payment->debit_offsets;
+ my @account_offsets = $payment->credit_offsets->as_list;
if ( C4::Context->preference('UseEmailReceipts') ) {
if (
my $letter = C4::Letters::GetPreparedLetter(
{
credit_id => $line->id,
type => 'CREATE',
- amount => $amount
+ amount => $amount * -1
}
)->store();
if ( exists( $params->{debits} ) ) {
$credit = $credit->apply(
{
- debits => $params->{debits},
- offset_type => $Koha::Account::offset_type->{$params->{type}}
+ debits => $params->{debits}
}
);
}
{
$credit = $credit->apply(
{
- debits => [ $self->outstanding_debits->as_list ],
- offset_type => $Koha::Account::offset_type->{$params->{type}}
+ debits => [ $self->outstanding_debits->as_list ]
}
);
}
# Offset against credits
for my $credit ( @{$outstanding_credits} ) {
- $credit->apply(
- { debits => [$payout], offset_type => 'PAYOUT' } );
+ $credit->apply( { debits => [$payout] } );
$payout->discard_changes;
last if $payout->amountoutstanding == 0;
}