X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FTaxEngine%2Finternal.pm;h=3b13510b358cc7172cd01b55ef4fb65bd1741730;hb=76d6fe17d02b77301619065ad43d7300432e977c;hp=60f7aad27fe09c7692e4086b6d0710c76befd65a;hpb=7516e3da0f17eeecba27219ef96a8b5f46af2083;p=freeside.git diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm index 60f7aad27..3b13510b3 100644 --- a/FS/FS/TaxEngine/internal.pm +++ b/FS/FS/TaxEngine/internal.pm @@ -15,10 +15,11 @@ my %part_pkg_cache; sub add_sale { my ($self, $cust_bill_pkg) = @_; - my $cust_pkg = $cust_bill_pkg->cust_pkg; - my $pkgpart = $cust_bill_pkg->pkgpart_override || $cust_pkg->pkgpart; - my $part_pkg = $part_pkg_cache{$pkgpart} ||= FS::part_pkg->by_key($pkgpart) - or die "pkgpart $pkgpart not found"; + + my $part_item = $cust_bill_pkg->part_X; + my $location = $cust_bill_pkg->tax_location; + my $custnum = $self->{cust_main}->custnum; + push @{ $self->{items} }, $cust_bill_pkg; my $location = $cust_pkg->tax_location; # cacheable? @@ -46,9 +47,10 @@ sub add_sale { $taxhash_elim{ shift(@elim) } = ''; } while ( !scalar(@taxes) && scalar(@elim) ); - foreach (@taxes) { - my $taxnum = $_->taxnum; - $self->{taxes}->{$taxnum} ||= [ $_ ]; + foreach my $tax (@taxes) { + my $taxnum = $tax->taxnum; + $self->{taxes}->{$taxnum} ||= [ $tax ]; + $cust_bill_pkg->set_exemptions( $tax, 'custnum' => $custnum ); push @{ $self->{taxes}->{$taxnum} }, $cust_bill_pkg; } }