foreach my $tax ( keys %$taxlisthash ) {
foreach ( @{ $taxlisthash->{$tax} }[1 ... scalar(@{ $taxlisthash->{$tax} })] ) {
next unless ref($_) eq 'FS::cust_bill_pkg';
-
- unless ( $packagemap{$_->pkgnum} ) {
- warn "WARNING: can't move cust_tax_exempt_pkg records for pkgnum".
- $_->pkgnum. " - not in our line item list";
- next;
- }
-
push @{ $packagemap{$_->pkgnum}->_cust_tax_exempt_pkg },
splice( @{ $_->_cust_tax_exempt_pkg } );
}
my $recur = 0;
my $unitrecur = 0;
my $sdate;
- if ( ! $cust_pkg->get('susp')
- and ! $cust_pkg->get('start_date')
- and ( $part_pkg->getfield('freq') ne '0'
- && ( $cust_pkg->getfield('bill') || 0 ) <= $time
- )
- || ( $part_pkg->plan eq 'voip_cdr'
- && $part_pkg->option('bill_every_call')
- )
- || ( $options{cancel} )
+ if ( ! $cust_pkg->start_date
+ and ( ! $cust_pkg->susp || $part_pkg->option('suspend_bill') )
+ and
+ ( $part_pkg->freq ne '0' && ( $cust_pkg->bill || 0 ) <= $time )
+ || ( $part_pkg->plan eq 'voip_cdr'
+ && $part_pkg->option('bill_every_call')
+ )
+ || $options{cancel}
) {
# XXX should this be a package event? probably. events are called
# If $cust_pkg has been modified, update it (if we're a real pkgpart)
###
- if ( $lineitems || $options{has_hidden} ) {
+ if ( $lineitems ) {
if ( $cust_pkg->modified && $cust_pkg->pkgpart == $real_pkgpart ) {
# hmm.. and if just the options are modified in some weird price plan?
)
{
- if ( $conf->exists('tax-pkg_address') && $cust_pkg->locationnum ) {
- return "fatal: Can't (yet) use tax-pkg_address with taxproducts";
- }
-
foreach my $class (@classes) {
- my $err_or_ref = $self->_gather_taxes( $part_pkg, $class );
+ my $err_or_ref = $self->_gather_taxes( $part_pkg, $class, $cust_pkg );
return $err_or_ref unless ref($err_or_ref);
$taxes{$class} = $err_or_ref;
}
unless (exists $taxes{''}) {
- my $err_or_ref = $self->_gather_taxes( $part_pkg, '' );
+ my $err_or_ref = $self->_gather_taxes( $part_pkg, '', $cust_pkg );
return $err_or_ref unless ref($err_or_ref);
$taxes{''} = $err_or_ref;
}
my $self = shift;
my $part_pkg = shift;
my $class = shift;
+ my $cust_pkg = shift;
local($DEBUG) = $FS::cust_main::DEBUG if $FS::cust_main::DEBUG > $DEBUG;
- my @taxes = ();
my $geocode = $self->geocode('cch');
+ $geocode = $cust_pkg->geocode('cch')
+ if ( $conf->exists('tax-pkg_address') && $cust_pkg->locationnum );
+ my @taxes = ();
my @taxclassnums = map { $_->taxclassnum }
$part_pkg->part_pkg_taxoverride($class);