X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg.pm;h=178042666e03f3de95f5b1d1f0a2a010d2e5547a;hp=156ab5bf0f8234ec49bdf6d7ec4a42ee6ad56586;hb=c0c5709fb022b83a482d0b35f7094505766d5868;hpb=76d6fe17d02b77301619065ad43d7300432e977c diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 156ab5bf0..178042666 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -238,12 +238,12 @@ sub insert { return "error inserting cust_bill_pkg_tax_location: $error"; } } else { # handoff - my $other; + my $other; # the as yet uninserted cust_bill_pkg $other = $link->billpkgnum ? $link->get('taxable_cust_bill_pkg') : $link->get('tax_cust_bill_pkg'); - my $link_array = $other->get('cust_bill_pkg_tax_location') || []; + my $link_array = $other->get( $tax_link_table ) || []; push @$link_array, $link; - $other->set('cust_bill_pkg_tax_location' => $link_array); + $other->set( $tax_link_table => $link_array); } } #foreach my $link } @@ -834,6 +834,8 @@ sub _item_discount { description => $self->mt('Discount'), amount => 0, ext_description => \@ext, + pkgpart => $self->pkgpart, + feepart => $self->feepart, # maybe should show quantity/unit discount? }; foreach my $pkg_discount (@pkg_discounts) { @@ -1122,7 +1124,10 @@ sub tax_locationnum { if ( $self->pkgnum ) { # normal sales return $self->cust_pkg->tax_locationnum; } elsif ( $self->feepart ) { # fees - return $self->cust_bill->cust_main->ship_locationnum; + my $custnum = $self->fee_origin->custnum; + if ( $custnum ) { + return FS::cust_main->by_key($custnum)->ship_locationnum; + } } else { # taxes return ''; } @@ -1133,7 +1138,10 @@ sub tax_location { if ( $self->pkgnum ) { # normal sales return $self->cust_pkg->tax_location; } elsif ( $self->feepart ) { # fees - return $self->cust_bill->cust_main->ship_location; + my $custnum = $self->fee_origin->custnum; + if ( $custnum ) { + return FS::cust_main->by_key($custnum)->ship_location; + } } else { # taxes return; } @@ -1275,7 +1283,7 @@ sub upgrade_tax_location { local $FS::cust_location::import = 1; my $conf = FS::Conf->new; # h_conf? - return if $conf->exists('enable_taxproducts'); #don't touch this case + return if $conf->config('tax_data_vendor'); #don't touch this case my $use_ship = $conf->exists('tax-ship_address'); my $use_pkgloc = $conf->exists('tax-pkg_address');