[freeside-commits] branch master updated. 658a793422919736368e1f0a29b0f448ef362908

Mark Wells mark at 420.am
Thu Jan 24 17:23:10 PST 2013


The branch, master has been updated
       via  658a793422919736368e1f0a29b0f448ef362908 (commit)
      from  62e9ed602776893e9bc45e7b1e2bfef18c254a64 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 658a793422919736368e1f0a29b0f448ef362908
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Jan 24 17:22:58 2013 -0800

    fix floating point error in taxline, #21099

diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm
index 5733595..fb80809 100644
--- a/FS/FS/cust_main_county.pm
+++ b/FS/FS/cust_main_county.pm
@@ -512,8 +512,10 @@ sub taxline {
   # now round and distribute
   my $extra_cents = sprintf('%.2f', $taxable_cents * $self->tax / 100) * 100
                     - $tax_cents;
+  # make sure we have an integer
+  $extra_cents = sprintf('%.0f', $extra_cents);
   if ( $extra_cents < 0 ) {
-    die "nonsense extra_cents value $extra_cents"; # because seriously, wtf
+    die "nonsense extra_cents value $extra_cents";
   }
   $tax_cents += $extra_cents;
   my $i = 0;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main_county.pm |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list