summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main_county.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/cust_main_county.pm')
-rw-r--r--FS/FS/cust_main_county.pm18
1 files changed, 12 insertions, 6 deletions
diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm
index 654e567..075ac32 100644
--- a/FS/FS/cust_main_county.pm
+++ b/FS/FS/cust_main_county.pm
@@ -278,10 +278,11 @@ sub taxline {
my $custnum = $cust_bill ? $cust_bill->custnum : $opt{'custnum'};
my $invoice_time = $cust_bill ? $cust_bill->_date : $opt{'invoice_time'};
my $cust_main = FS::cust_main->by_key($custnum) if $custnum > 0;
- if (!$cust_main) {
- # better way to handle this? should we just assume that it's taxable?
- die "unable to calculate taxes for an unknown customer\n";
- }
+ # (to avoid complications with estimated tax on quotations, assume it's
+ # taxable if there is no customer)
+ #if (!$cust_main) {
+ #die "unable to calculate taxes for an unknown customer\n";
+ #}
# set a flag if the customer is tax-exempt
my $exempt_cust;
@@ -313,6 +314,7 @@ sub taxline {
my @tax_location;
foreach my $cust_bill_pkg (@$taxables) {
+ # careful... may be a cust_bill_pkg or a quotation_pkg
my $cust_pkg = $cust_bill_pkg->cust_pkg;
my $part_pkg = $cust_bill_pkg->part_pkg;
@@ -379,7 +381,11 @@ sub taxline {
}
if ( $self->exempt_amount && $self->exempt_amount > 0
- and $taxable_charged > 0 ) {
+ and $taxable_charged > 0
+ and $cust_main ) {
+
+ # XXX monthly exemptions currently don't work on quotations
+
# If the billing period extends across multiple calendar months,
# there may be several months of exemption available.
my $sdate = $cust_bill_pkg->sdate || $invoice_time;
@@ -493,7 +499,7 @@ sub taxline {
}
}
- } # if exempt_amount
+ } # if exempt_amount and $cust_main
$_->taxnum($self->taxnum) foreach @new_exemptions;