###
my $setup = 0;
+ my $unitsetup = 0;
if ( ! $cust_pkg->setup &&
(
( $conf->exists('disable_setup_suspended_pkgs') &&
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
# 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') &&
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)
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 {