X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main_county.pm;h=ae3b66cd955e6638e90dabd53019ecd9728f121a;hb=f76241e0d0252e50170706d8bfa9b79cdbae59b4;hp=bb60abb45df761f98f783e0f7eaeb590951c0aa7;hpb=6397a30ca9f53c90a503da8786925ec75535a699;p=freeside.git diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index bb60abb45..ae3b66cd9 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -2,7 +2,7 @@ package FS::cust_main_county; use strict; use vars qw( @ISA @EXPORT_OK $conf - @cust_main_county %cust_main_county $countyflag ); + @cust_main_county %cust_main_county $countyflag ); # $cityflag ); use Exporter; use FS::Record qw( qsearch dbh ); use FS::cust_bill_pkg; @@ -17,6 +17,7 @@ use FS::cust_tax_exempt_pkg; @cust_main_county = (); $countyflag = ''; +#$cityflag = ''; #ask FS::UID to run this stuff for us later $FS::UID::callback{'FS::cust_main_county'} = sub { @@ -55,10 +56,14 @@ currently supported: =item taxnum - primary key (assigned automatically for new tax rates) -=item state +=item district - tax district (optional) + +=item city =item county +=item state + =item country =item tax - percentage @@ -116,8 +121,10 @@ sub check { $self->exempt_amount(0) unless $self->exempt_amount; $self->ut_numbern('taxnum') - || $self->ut_anything('state') + || $self->ut_alphan('district') + || $self->ut_textn('city') || $self->ut_textn('county') + || $self->ut_anything('state') || $self->ut_text('country') || $self->ut_float('tax') || $self->ut_textn('taxclass') # ... @@ -169,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 )) { @@ -252,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?)".