summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-03-10 02:26:50 +0000
committerivan <ivan>2011-03-10 02:26:50 +0000
commit398cc9feb70fa1ec6f95781b0410347a152128ec (patch)
tree962a03bea2c32d74ee72c489e802274a4fe3f049
parentcca6ce92e9806fd909f5a6540f921ad9de064483 (diff)
avoid runcentral's weird proble distributing tax exemptions since it doesn't apply to them anyway, RT#11476
-rw-r--r--FS/FS/cust_main/Billing.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 0dfaa49df..49ffbfe84 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -726,8 +726,16 @@ sub calculate_taxes {
foreach my $tax ( keys %$taxlisthash ) {
foreach ( @{ $taxlisthash->{$tax} }[1 ... scalar(@{ $taxlisthash->{$tax} })] ) {
next unless ref($_) eq 'FS::cust_bill_pkg';
- push @{ $packagemap{$_->pkgnum}->_cust_tax_exempt_pkg },
- splice( @{ $_->_cust_tax_exempt_pkg } );
+
+ my @cust_tax_exempt_pkg = splice( @{ $_->_cust_tax_exempt_pkg } );
+
+ next unless @cust_tax_exempt_pkg; #just avoiding the prob when irrelevant?
+ die "can't distribute tax exemptions: no line item for ". Dumper($_).
+ " in packagemap ". join(',', sort {$a<=>$b} keys %packagemap). "\n"
+ unless $packagemap{$_->pkgnum};
+
+ push @{ $packagemap{$_->pkgnum}->_cust_tax_exempt_pkg },
+ @cust_tax_exempt_pkg;
}
}