X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main_county.pm;h=6316f239a1428d478fc3aefbf1e1387b5767f346;hb=0f5c3c06074db3d1eae6c0cd73c13f5561fcf219;hp=ab1ac1e33c54598e3d50ae1d4b319c477d846434;hpb=0b94e40c533288be69a4fe60da36a385d31eff7f;p=freeside.git diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index ab1ac1e33..6316f239a 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -56,6 +56,8 @@ currently supported: =item taxnum - primary key (assigned automatically for new tax rates) +=item district - tax district (optional) + =item city =item county @@ -119,6 +121,7 @@ sub check { $self->exempt_amount(0) unless $self->exempt_amount; $self->ut_numbern('taxnum') + || $self->ut_alphan('district') || $self->ut_textn('city') || $self->ut_textn('county') || $self->ut_anything('state') @@ -173,7 +176,7 @@ with different tax classes. sub sql_taxclass_sameregion { my $self = shift; - my $same_query = 'SELECT taxclass FROM cust_main_county '. + my $same_query = 'SELECT DISTINCT taxclass FROM cust_main_county '. ' WHERE taxnum != ? AND country = ?'; my @same_param = ( 'taxnum', 'country' ); foreach my $opt_field (qw( state county )) { @@ -256,7 +259,10 @@ sub taxline { my ($mon,$year) = (localtime( $cust_bill_pkg->sdate || $invoice_date ) )[4,5]; $mon++; - my $freq = $part_pkg->freq || 1; + my $freq = $cust_bill_pkg->freq; + unless ($freq) { + $freq = $part_pkg->freq || 1; # less trustworthy fallback + } if ( $freq !~ /(\d+)$/ ) { $dbh->rollback if $oldAutoCommit; return "daily/weekly package definitions not (yet?)". @@ -325,7 +331,7 @@ sub taxline { 'taxnum' => $self->taxnum, 'year' => 1900+$year, 'month' => $mon, - 'amount' => sprintf("%.2f", $addl ), + 'amount' => sprintf('%.2f', $addl ), } ); if ($cust_bill_pkg->billpkgnum) { $cust_tax_exempt_pkg->billpkgnum($cust_bill_pkg->billpkgnum);