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

(-)a/Koha/Account.pm (-3 / +3 lines)
Lines 515-529 sub lines { Link Here
515
    );
515
    );
516
}
516
}
517
517
518
=head3 normalize_balance
518
=head3 reconcile_balance
519
519
520
$account->normalize_balance();
520
$account->reconcile_balance();
521
521
522
Find outstanding credits and use them to pay outstanding debits
522
Find outstanding credits and use them to pay outstanding debits
523
523
524
=cut
524
=cut
525
525
526
sub normalize_balance {
526
sub reconcile_balance {
527
    my ($self) = @_;
527
    my ($self) = @_;
528
528
529
    my $outstanding_debits  = $self->outstanding_debits;
529
    my $outstanding_debits  = $self->outstanding_debits;
(-)a/t/db_dependent/Koha/Account.t (-5 / +4 lines)
Lines 226-232 subtest 'lines() tests' => sub { Link Here
226
    $schema->storage->txn_rollback;
226
    $schema->storage->txn_rollback;
227
};
227
};
228
228
229
subtest 'normalize_balance' => sub {
229
subtest 'reconcile_balance' => sub {
230
230
231
    plan tests => 3;
231
    plan tests => 3;
232
232
Lines 260-266 subtest 'normalize_balance' => sub { Link Here
260
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
260
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
261
        is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' );
261
        is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' );
262
262
263
        $account->normalize_balance();
263
        $account->reconcile_balance();
264
264
265
        is( $account->balance(), -5, "Account balance is -5" );
265
        is( $account->balance(), -5, "Account balance is -5" );
266
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
266
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
Lines 298-304 subtest 'normalize_balance' => sub { Link Here
298
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
298
        is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' );
299
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
299
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
300
300
301
        $account->normalize_balance();
301
        $account->reconcile_balance();
302
302
303
        is( $account->balance(), 0, "Account balance is 0" );
303
        is( $account->balance(), 0, "Account balance is 0" );
304
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
304
        is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' );
Lines 337-343 subtest 'normalize_balance' => sub { Link Here
337
        is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' );
337
        is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' );
338
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
338
        is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' );
339
339
340
        $account->normalize_balance();
340
        $account->reconcile_balance();
341
341
342
        is( $account->balance(), 5, "Account balance is 5" );
342
        is( $account->balance(), 5, "Account balance is 5" );
343
        is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' );
343
        is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' );
344
- 

Return to bug 21896