X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=1f063d9503d1a3142b81a012183d15986a937e43;hb=725f4954f7d4efaf7cd3fd5e402a5dacd5d185b9;hp=1e43519312ac3edf0258109d4497432c9413cfd2;hpb=a67fd3bbfeec137ebf494e36eaa920145b8509a1;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 1e4351931..1f063d950 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2201,12 +2201,16 @@ Available options are: =item ban - can be set true to ban this customer's credit card or ACH information, if present. +=item nobill - can be set true to skip billing if it might otherwise be done. + =back Always returns a list: an empty list on success or a list of errors. =cut +# nb that dates are not specified as valid options to this method + sub cancel { my( $self, %opt ) = @_; @@ -2232,6 +2236,13 @@ sub cancel { my @pkgs = $self->ncancelled_pkgs; + if ( !$opt{nobill} && $conf->exists('bill_usage_on_cancel') ) { + $opt{nobill} = 1; + my $error = $self->bill( pkg_list => [ @pkgs ], cancel => 1 ); + warn "Error billing during cancel, custnum ". $self->custnum. ": $error" + if $error; + } + warn "$me cancelling ". scalar($self->ncancelled_pkgs). "/". scalar(@pkgs). " packages for customer ". $self->custnum. "\n" if $DEBUG; @@ -2441,6 +2452,13 @@ An array ref of specific packages (objects) to attempt billing, instead trying a Used in conjunction with the I