X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=d0d62bd6a886993a1dea0aaa66cf3b4aad669cb5;hp=1262c3874ff37bd9f67b4c3683711d6ec3ded843;hb=bb7e827141c9ed68f30765c9ca2ddcd1d760ad2d;hpb=a2403695de3d9802bb5ce10bf64f64d8358141a9 diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 1262c3874..d0d62bd6a 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -491,6 +491,20 @@ sub delete { } } + #fix the invoice amount + + 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; + + my $error = $cust_bill->replace; + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return $error; + } + my $error = $self->SUPER::delete(@_); if ( $error ) { $dbh->rollback if $oldAutoCommit;