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

(-)a/C4/Members.pm (+1 lines)
Lines 819-824 sub GetMemberAccountRecords { Link Here
819
        $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors
819
        $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors
820
    }
820
    }
821
    $total /= 1000;
821
    $total /= 1000;
822
    $total = sprintf "%.2f",$total;
822
    return ( $total, \@acctlines,$numlines);
823
    return ( $total, \@acctlines,$numlines);
823
}
824
}
824
825
(-)a/t/db_dependent/Members.t (-2 / +12 lines)
Lines 381-387 is( Check_Userid( C4::Context->config('user'), '' ), 0, Link Here
381
381
382
subtest 'GetMemberAccountRecords' => sub {
382
subtest 'GetMemberAccountRecords' => sub {
383
383
384
    plan tests => 2;
384
    plan tests => 3;
385
385
386
    my $borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber };
386
    my $borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber };
387
    my $accountline_1  = $builder->build({
387
    my $accountline_1  = $builder->build({
Lines 395-400 subtest 'GetMemberAccountRecords' => sub { Link Here
395
    my ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
395
    my ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
396
    is( $total , 64.60, "Rounding works correctly in total calculation (single value)" );
396
    is( $total , 64.60, "Rounding works correctly in total calculation (single value)" );
397
397
398
    my $borrowernumber2 = $builder->build({ source => 'Borrower' })->{ borrowernumber };
399
    my $accountline_2  = $builder->build({
400
        source => 'Accountline',
401
        value  => {
402
            borrowernumber    => $borrowernumber2,
403
            amountoutstanding => 7.56
404
        }
405
    });
406
    ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber2 );
407
    is( $total , 7.56, "Rounding works correctly in total calculation (single value)" );
408
398
    my $accountline_2 = $builder->build({
409
    my $accountline_2 = $builder->build({
399
        source => 'Accountline',
410
        source => 'Accountline',
400
        value  => {
411
        value  => {
401
- 

Return to bug 18487