Bugzilla – Attachment 62600 Details for
Bug 18487
GetMemberAccountRecords returning imprecise amount - causing pay issue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18487 - GetMemberAccountRecords returning imprecise amount - causing pay issue
Bug-18487---GetMemberAccountRecords-returning-impr.patch (text/plain), 2.13 KB, created by
Nick Clemens (kidclamp)
on 2017-04-24 13:32:35 UTC
(
hide
)
Description:
Bug 18487 - GetMemberAccountRecords returning imprecise amount - causing pay issue
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-04-24 13:32:35 UTC
Size:
2.13 KB
patch
obsolete
>From ec735cc34128f5031c43f2addd262c8ec0d4f915 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 24 Apr 2017 09:17:43 -0400 >Subject: [PATCH] Bug 18487 - GetMemberAccountRecords returning imprecise > amount - causing pay issue > >To test: >1 - Create a manual fine of 7.56 >2 - Attempt to 'pay amount' 7.56 >3 - Error >4 - Apply patch >5 - payment should succeed >--- > C4/Members.pm | 1 + > t/db_dependent/Members.t | 13 ++++++++++++- > 2 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index ee10cc7..672da95 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -819,6 +819,7 @@ sub GetMemberAccountRecords { > $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors > } > $total /= 1000; >+ $total = sprintf "%.2f",$total; > return ( $total, \@acctlines,$numlines); > } > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 8520777..7fbb8fd 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -381,7 +381,7 @@ is( Check_Userid( C4::Context->config('user'), '' ), 0, > > subtest 'GetMemberAccountRecords' => sub { > >- plan tests => 2; >+ plan tests => 3; > > my $borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber }; > my $accountline_1 = $builder->build({ >@@ -395,6 +395,17 @@ subtest 'GetMemberAccountRecords' => sub { > my ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber ); > is( $total , 64.60, "Rounding works correctly in total calculation (single value)" ); > >+ my $borrowernumber2 = $builder->build({ source => 'Borrower' })->{ borrowernumber }; >+ my $accountline_2 = $builder->build({ >+ source => 'Accountline', >+ value => { >+ borrowernumber => $borrowernumber2, >+ amountoutstanding => 7.56 >+ } >+ }); >+ ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber2 ); >+ is( $total , 7.56, "Rounding works correctly in total calculation (single value)" ); >+ > my $accountline_2 = $builder->build({ > source => 'Accountline', > value => { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18487
: 62600