projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7c11a4f
)
fix rare FP rounding errors on void, RT#84904
author
Ivan Kohler
<ivan@freeside.biz>
Tue, 29 Sep 2020 21:27:41 +0000
(14:27 -0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Tue, 29 Sep 2020 21:27:41 +0000
(14:27 -0700)
FS/FS/cust_bill_pkg.pm
patch
|
blob
|
history
diff --git
a/FS/FS/cust_bill_pkg.pm
b/FS/FS/cust_bill_pkg.pm
index
6f9c74a
..
f0d7105
100644
(file)
--- a/
FS/FS/cust_bill_pkg.pm
+++ b/
FS/FS/cust_bill_pkg.pm
@@
-392,7
+392,7
@@
sub void {
}
}
- $error = $self->delete;
+ $error = $self->delete
( skip_update_cust_bill_charged=>1 )
;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
@@
-448,6
+448,7
@@
Not recommended.
sub delete {
my $self = shift;
sub delete {
my $self = shift;
+ my %opt = @_;
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
@@
-493,16
+494,27
@@
sub delete {
}
}
}
}
- #fix the invoice amount
+ unless ( $opt{skip_update_cust_bill_charged} ) {
+
+ #fix the invoice amount
+
+ my $cust_bill = $self->cust_bill;
+ my $charged = $cust_bill->charged - $self->setup - $self->recur;
+ $charged = sprintf('%.2f', $charged + 0.00000001 );
+ $cust_bill->charged( $charged );
- my $cust_bill = $self->cust_bill;
-
$cust_bill->charged( $cust_bill->charged - $self->setup - $self->recur )
;
+ #not adding a cc surcharge, but this override lets us modify charged
+
$cust_bill->{'Hash'}{'cc_surcharge_replace_hack'} = 1
;
- #not adding a cc surcharge, but this override lets us modify charged
- $cust_bill->{'Hash'}{'cc_surcharge_replace_hack'} = 1;
+ my $error = $cust_bill->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+
+ }
- my $error = $cust_bill->replace
- || $self->SUPER::delete(@_);
+ my $error = $self->SUPER::delete(@_);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;