diff options
| -rw-r--r-- | FS/FS/cust_main.pm | 18 | ||||
| -rw-r--r-- | FS/FS/part_pkg/flat.pm | 8 | 
2 files changed, 20 insertions, 6 deletions
| diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 1f2fe886b..33788f3b5 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2107,6 +2107,7 @@ sub bill {        ###        my $setup = 0; +      my $unitsetup = 0;        if ( ! $cust_pkg->setup &&             (               ( $conf->exists('disable_setup_suspended_pkgs') && @@ -2125,6 +2126,8 @@ sub bill {            return "$@ running calc_setup for $cust_pkg\n";          } +        $unitsetup = $cust_pkg->part_pkg->unit_setup || $setup; #XXX uuh +          $cust_pkg->setfield('setup', $time)            unless $cust_pkg->setup;                #do need it, but it won't get written to the db @@ -2136,7 +2139,9 @@ sub bill {        # bill recurring fee        ###  +      #XXX unit stuff here too        my $recur = 0; +      my $unitrecur = 0;        my $sdate;        if ( $part_pkg->getfield('freq') ne '0' &&             ! $cust_pkg->getfield('susp') && @@ -2240,11 +2245,14 @@ sub bill {            warn "    charges (setup=$setup, recur=$recur); adding line items\n"              if $DEBUG > 1;            my $cust_bill_pkg = new FS::cust_bill_pkg { -            'pkgnum'  => $cust_pkg->pkgnum, -            'setup'   => $setup, -            'recur'   => $recur, -            'sdate'   => $sdate, -            'edate'   => $cust_pkg->bill, +            'pkgnum'    => $cust_pkg->pkgnum, +            'setup'     => $setup, +            'unitsetup' => $unitsetup, +            'recur'     => $recur, +            'unitrecur' => $unitrecur, +            'quantity'  => $cust_pkg->quantity, +            'sdate'     => $sdate, +            'edate'     => $cust_pkg->bill,              'details' => \@details,            };            $cust_bill_pkg->pkgpart_override($part_pkg->pkgpart) diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index 1d93e55cd..3480964d0 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -101,7 +101,13 @@ sub calc_setup {    my $quantity = $cust_pkg->quantity || 1; -  sprintf("%.2f", $quantity * $self->option('setup_fee') ); +  sprintf("%.2f", $quantity * $self->unit_setup($cust_pkg, $sdate, $details) ); +} + +sub unit_setup { +  my($self, $cust_pkg, $sdate, $details ) = @_; + +  $self->option('setup_fee');  }  sub calc_recur { | 
