X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FBilling.pm;h=aeb0c51d5b9b4e7fe43ee2a495c5a235072c7cd8;hb=581d4b07156ba59e7445235305872c74aa97c6d9;hp=7ae3d459e94b08a451e06d381669b6f1d5d8e4d3;hpb=e93b81ba22b5f772fbbea7370cde3b9760ef7080;p=freeside.git diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index 7ae3d459e..aeb0c51d5 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -547,7 +547,7 @@ sub bill { #create the new invoice my $cust_bill = new FS::cust_bill ( { 'custnum' => $self->custnum, - '_date' => ( $invoice_time ), + '_date' => $invoice_time, 'charged' => $charged, 'billing_balance' => $balance, 'previous_balance' => $previous_balance, @@ -897,6 +897,7 @@ sub _make_lines { 'discounts' => \@discounts, 'real_pkgpart' => $real_pkgpart, 'freq_override' => $options{freq_override} || '', + 'setup_fee' => 0, ); my $method = $options{cancel} ? 'calc_cancel' : 'calc_recur'; @@ -926,6 +927,14 @@ sub _make_lines { } + if ( $param{'setup_fee'} ) { + # Add an additional setup fee at the billing stage. + # Used for prorate_defer_bill. + $setup += $param{'setup_fee'}; + $unitsetup += $param{'setup_fee'}; + $lineitems++; + } + } warn "\$setup is undefined" unless defined($setup); @@ -946,6 +955,7 @@ sub _make_lines { if $DEBUG >1; my $error = $cust_pkg->replace( $old_cust_pkg, + 'depend_jobnum'=>$options{depend_jobnum}, 'options' => { $cust_pkg->options }, ) unless $options{no_commit};