X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pkg_tax_location.pm;h=7c67c2df8b35188079d53c61149dcb3d0902ef26;hb=0586dafb71594726138cd3b7b721b9f1a0b79ae2;hp=468e6ae99fb0c684cddac1a5f4057acd43c274c2;hpb=32072dbf59a054529f5304574c0f56f9567d14d0;p=freeside.git diff --git a/FS/FS/cust_bill_pkg_tax_location.pm b/FS/FS/cust_bill_pkg_tax_location.pm index 468e6ae99..7c67c2df8 100644 --- a/FS/FS/cust_bill_pkg_tax_location.pm +++ b/FS/FS/cust_bill_pkg_tax_location.pm @@ -122,7 +122,7 @@ sub check { || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg', 'billpkgnum' ) || $self->ut_number('taxnum') #cust_bill_pkg/tax_rate key, based on taxtype || $self->ut_enum('taxtype', [ qw( FS::cust_main_county FS::tax_rate ) ] ) - || $self->ut_foreign_key('pkgnum', 'cust_pkg', 'pkgnum' ) + || $self->ut_number('pkgnum', 'cust_pkg', 'pkgnum' ) || $self->ut_foreign_key('locationnum', 'cust_location', 'locationnum' ) || $self->ut_money('amount') || $self->ut_foreign_key('taxable_billpkgnum', 'cust_bill_pkg', 'billpkgnum') @@ -144,6 +144,19 @@ Returns the cust_bill_pkg object for the I charge. Returns the associated cust_location object +=item taxname + +Returns the tax name (for populating the itemdesc field). + +=cut + +sub taxname { + my $self = shift; + my $cust_main_county = FS::cust_main_county->by_key($self->taxnum) + or return ''; + $cust_main_county->taxname || 'Tax'; +} + =item desc Returns a description for this tax line item constituent. Currently this @@ -325,7 +338,7 @@ sub upgrade_taxable_billpkgnum { } #for $i } else { # the more complicated case - $log->warn("mismatched charges and tax links in pkg#$pkgnum", + $log->warning("mismatched charges and tax links in pkg#$pkgnum", object => $cust_bill); my $tax_amount = sum(map {$_->amount} @tax_links); # remove all tax link records and recreate them to be 1:1 with