X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2FTaxEngine%2Finternal.pm;fp=FS%2FFS%2FTaxEngine%2Finternal.pm;h=df2d6095678a8e3ece065d31e64aa333488d8463;hb=94c7f944bc5836e071ff3484cbba7e5b94e075a3;hp=3e3e7e520055060a2a696887621d5eb8457b36c8;hpb=54632ad75498381c88e32850f7dda39965f7ad33;p=freeside.git diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm index 3e3e7e520..df2d60956 100644 --- a/FS/FS/TaxEngine/internal.pm +++ b/FS/FS/TaxEngine/internal.pm @@ -100,8 +100,6 @@ sub taxline { foreach my $cust_bill_pkg (@$taxables) { - my $cust_pkg = $cust_bill_pkg->cust_pkg; - my $part_pkg = $cust_bill_pkg->part_pkg; my @new_exemptions; my $taxable_charged = $cust_bill_pkg->setup + $cust_bill_pkg->recur or next; # don't create zero-amount exemptions @@ -125,25 +123,28 @@ sub taxline { $taxable_charged = 0; } + + if ( my $part_pkg = $cust_bill_pkg->part_pkg ) { - if ( ($part_pkg->setuptax eq 'Y' or $tax_object->setuptax eq 'Y') - and $cust_bill_pkg->setup > 0 and $taxable_charged > 0 ) { + if ( ($part_pkg->setuptax eq 'Y' or $tax_object->setuptax eq 'Y') + and $cust_bill_pkg->setup > 0 and $taxable_charged > 0 ) { - push @new_exemptions, FS::cust_tax_exempt_pkg->new({ - amount => $cust_bill_pkg->setup, - exempt_setup => 'Y' - }); - $taxable_charged -= $cust_bill_pkg->setup; + push @new_exemptions, FS::cust_tax_exempt_pkg->new({ + amount => $cust_bill_pkg->setup, + exempt_setup => 'Y' + }); + $taxable_charged -= $cust_bill_pkg->setup; + } - } - if ( ($part_pkg->recurtax eq 'Y' or $tax_object->recurtax eq 'Y') - and $cust_bill_pkg->recur > 0 and $taxable_charged > 0 ) { + if ( ($part_pkg->recurtax eq 'Y' or $tax_object->recurtax eq 'Y') + and $cust_bill_pkg->recur > 0 and $taxable_charged > 0 ) { - push @new_exemptions, FS::cust_tax_exempt_pkg->new({ - amount => $cust_bill_pkg->recur, - exempt_recur => 'Y' - }); - $taxable_charged -= $cust_bill_pkg->recur; + push @new_exemptions, FS::cust_tax_exempt_pkg->new({ + amount => $cust_bill_pkg->recur, + exempt_recur => 'Y' + }); + $taxable_charged -= $cust_bill_pkg->recur; + } }