X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=92a51af352b72d880bde80073151ce9f4c2292d1;hp=de76b0a29206a094eb88ad3babb764ea80bab778;hb=d5c36bbc9efd8dd9270a115c6d4ed376e8d91cff;hpb=16cff5502d4b5c4ee97cd6f3214ff77d60c7a60c diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index de76b0a29..92a51af35 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -386,7 +386,7 @@ sub void { } - $error = $self->delete; + $error = $self->delete( skip_update_cust_bill_charged=>1 ); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; @@ -406,6 +406,7 @@ Not recommended. sub delete { my $self = shift; + my %opt = @_; local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; @@ -451,16 +452,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;