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

(-)a/Koha/Account.pm (-3 / +3 lines)
Lines 492-506 sub non_issues_charges { Link Here
492
      : 0;
492
      : 0;
493
}
493
}
494
494
495
=head3 normalize_balance
495
=head3 reconcile_balance
496
496
497
$account->normalize_balance();
497
$account->reconcile_balance();
498
498
499
Find outstanding credits and use them to pay outstanding debits
499
Find outstanding credits and use them to pay outstanding debits
500
500
501
=cut
501
=cut
502
502
503
sub normalize_balance {
503
sub reconcile_balance {
504
    my ($self) = @_;
504
    my ($self) = @_;
505
505
506
    my $outstanding_debits  = $self->outstanding_debits;
506
    my $outstanding_debits  = $self->outstanding_debits;
(-)a/t/db_dependent/Koha/Account.t (-5 / +4 lines)
Lines 192-198 subtest 'add_credit() tests' => sub { Link Here
192
    $schema->storage->txn_rollback;
192
    $schema->storage->txn_rollback;
193
};
193
};
194
194
195
subtest 'normalize_balance' => sub {
195
subtest 'reconcile_balance' => sub {
196
196
197
    plan tests => 3;
197
    plan tests => 3;
198
198
Lines 226-232 subtest 'normalize_balance' => sub { Link Here
226
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
226
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
227
        is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' );
227
        is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' );
228
228
229
        $account->normalize_balance();
229
        $account->reconcile_balance();
230
230
231
        is( $account->balance(), -5, "Account balance is -5" );
231
        is( $account->balance(), -5, "Account balance is -5" );
232
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
232
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
Lines 264-270 subtest 'normalize_balance' => sub { Link Here
264
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
264
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
265
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
265
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
266
266
267
        $account->normalize_balance();
267
        $account->reconcile_balance();
268
268
269
        is( $account->balance(), 0, "Account balance is 0" );
269
        is( $account->balance(), 0, "Account balance is 0" );
270
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
270
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
Lines 303-309 subtest 'normalize_balance' => sub { Link Here
303
        is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' );
303
        is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' );
304
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
304
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
305
305
306
        $account->normalize_balance();
306
        $account->reconcile_balance();
307
307
308
        is( $account->balance(), 5, "Account balance is 5" );
308
        is( $account->balance(), 5, "Account balance is 5" );
309
        is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' );
309
        is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' );
310
- 

Return to bug 21896