X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fcust_main%2FBilling.pm;h=608dbe15e0c9ca1eb5df69abcc6fcba982810be9;hb=9be8cf75b8e510fb0e6489f90188d391b861b247;hp=8f7038f0d25b610190c7772022db033b4e3abebc;hpb=50c7d973c88a7ffb53bb74837420398e45d9ac88;p=freeside.git diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index 8f7038f0d..608dbe15e 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -356,6 +356,11 @@ sub bill { my $time = $options{'time'} || time; my $invoice_time = $options{'invoice_time'} || $time; + my $cmp_time = ( $conf->exists('next-bill-ignore-time') + ? day_end( $time ) + : $time + ); + $options{'not_pkgpart'} ||= {}; $options{'not_pkgpart'} = { map { $_ => 1 } split(/\s*,\s*/, $options{'not_pkgpart'}) @@ -443,7 +448,7 @@ sub bill { my $next_bill = $cust_pkg->getfield('bill') || 0; my $error; - while ( $next_bill <= $time ) { + while ( $next_bill <= $cmp_time ) { $error = $self->_make_lines( 'part_pkg' => $part_pkg, 'cust_pkg' => $cust_pkg, @@ -1160,6 +1165,10 @@ sub _make_lines { return $error if $error; } + $cust_bill_pkg->set_display( part_pkg => $part_pkg, + real_pkgpart => $real_pkgpart, + ); + push @$cust_bill_pkgs, $cust_bill_pkg; } #if $setup != 0 || $recur != 0 @@ -1225,6 +1234,8 @@ sub _handle_taxes { ? 'ship_' : ''; %taxhash = map { $_ => $self->get("$prefix$_") } @loc_keys; + # special case--there's no 'ship_district' field + $taxhash{'district'} = $self->get('district'); } $taxhash{'taxclass'} = $part_pkg->taxclass; @@ -1275,12 +1286,6 @@ sub _handle_taxes { } - #what's this doing in the middle of _handle_taxes? probably should split - #this into three parts above in _make_lines - $cust_bill_pkg->set_display( part_pkg => $part_pkg, - real_pkgpart => $real_pkgpart, - ); - my %tax_cust_bill_pkg = $cust_bill_pkg->disintegrate; foreach my $key (keys %tax_cust_bill_pkg) { my @taxes = @{ $taxes{$key} || [] };