diff --git a/Koha/Account.pm b/Koha/Account.pm index 064489f65f..80e8353368 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -515,15 +515,15 @@ sub lines { ); } -=head3 normalize_balance +=head3 reconcile_balance -$account->normalize_balance(); +$account->reconcile_balance(); Find outstanding credits and use them to pay outstanding debits =cut -sub normalize_balance { +sub reconcile_balance { my ($self) = @_; my $outstanding_debits = $self->outstanding_debits; diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index ad9da10f64..39c0664f27 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -226,7 +226,7 @@ subtest 'lines() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'normalize_balance' => sub { +subtest 'reconcile_balance' => sub { plan tests => 3; @@ -260,7 +260,7 @@ subtest 'normalize_balance' => sub { is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); is( $account->outstanding_credits->total_outstanding, -15, 'Outstanding credits sum -15' ); - $account->normalize_balance(); + $account->reconcile_balance(); is( $account->balance(), -5, "Account balance is -5" ); is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' ); @@ -298,7 +298,7 @@ subtest 'normalize_balance' => sub { is( $account->outstanding_debits->total_outstanding, 10, 'Outstanding debits sum 10' ); is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' ); - $account->normalize_balance(); + $account->reconcile_balance(); is( $account->balance(), 0, "Account balance is 0" ); is( $account->outstanding_debits->total_outstanding, 0, 'No outstanding debits' ); @@ -337,7 +337,7 @@ subtest 'normalize_balance' => sub { is( $account->outstanding_debits->total_outstanding, 15, 'Outstanding debits sum 15' ); is( $account->outstanding_credits->total_outstanding, -10, 'Outstanding credits sum -10' ); - $account->normalize_balance(); + $account->reconcile_balance(); is( $account->balance(), 5, "Account balance is 5" ); is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' );