X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=305ad63a6a92c339637032cb565685319d612d4b;hp=1262c3874ff37bd9f67b4c3683711d6ec3ded843;hb=bfba4dcd1478d5ace640464b3e2e05531f3db5e0;hpb=9996cfd8b87a47576dbac33a04007ec42d024d23 diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 1262c3874..305ad63a6 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -491,7 +491,16 @@ sub delete { } } - my $error = $self->SUPER::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 + || $self->SUPER::delete(@_); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error;