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

(-)a/Koha/Account/Line.pm (+4 lines)
Lines 497-502 sub reduce { Link Here
497
        Koha::Exceptions::Account::IsNotDebit->throw(
497
        Koha::Exceptions::Account::IsNotDebit->throw(
498
            error => 'Account line ' . $self->id . 'is a payout' );
498
            error => 'Account line ' . $self->id . 'is a payout' );
499
    }
499
    }
500
    if ( $self->debit_type_code eq 'VOID' ) {
501
        Koha::Exceptions::Account::IsNotDebit->throw(
502
            error => 'Account line ' . $self->id . 'is void' );
503
    }
500
504
501
    # Check for mandatory parameters
505
    # Check for mandatory parameters
502
    my @mandatory = ( 'interface', 'reduction_type', 'amount' );
506
    my @mandatory = ( 'interface', 'reduction_type', 'amount' );
(-)a/t/db_dependent/Koha/Account/Line.t (-2 / +24 lines)
Lines 1071-1077 subtest "payout() tests" => sub { Link Here
1071
1071
1072
subtest "reduce() tests" => sub {
1072
subtest "reduce() tests" => sub {
1073
1073
1074
    plan tests => 34;
1074
    plan tests => 35;
1075
1075
1076
    $schema->storage->txn_begin;
1076
    $schema->storage->txn_begin;
1077
1077
Lines 1254-1259 subtest "reduce() tests" => sub { Link Here
1254
    'Koha::Exceptions::Account::IsNotDebit',
1254
    'Koha::Exceptions::Account::IsNotDebit',
1255
      '->reduce() cannot be used on a payout debit';
1255
      '->reduce() cannot be used on a payout debit';
1256
1256
1257
    # Throw exception if attempting to reduce a voided debt
1258
    my $payment = Koha::Account::Line->new(
1259
        {
1260
            borrowernumber    => $borrower->borrowernumber,
1261
            amount            => -20,
1262
            amountoutstanding => -20,
1263
            interface         => 'commandline',
1264
            credit_type_code  => 'CREDIT'
1265
        }
1266
    )->store();
1267
    my $void = $payment->void(
1268
        {
1269
            interface   => 'intranet',
1270
            staff_id    => $staff->borrowernumber,
1271
            branch      => $branchcode,
1272
        }
1273
    );
1274
    throws_ok {
1275
        $void->reduce($reduce_params);
1276
    }
1277
    'Koha::Exceptions::Account::IsNotDebit',
1278
      '->reduce() cannot be used on a void debit';
1279
1257
    $schema->storage->txn_rollback;
1280
    $schema->storage->txn_rollback;
1258
};
1281
};
1259
1282
1260
- 

Return to bug 28664