X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_location.pm;h=21bf92feba0e75dcb246dc7faf57ca7b21483910;hp=63492dd33383e97cdf7798950309000ccfc7dc38;hb=5372897f367498972c96f5494e142e6e11b29eb8;hpb=569f676f4a06512a46120e12edc6a6410e93ff93 diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 63492dd33..21bf92feb 100644 --- a/FS/FS/cust_location.pm +++ b/FS/FS/cust_location.pm @@ -443,6 +443,26 @@ sub check { && $conf->exists('prospect_main-alt_address_format') && ! $self->location_kind; + # Do not allow bad tax district values in cust_location when + # using Washington State district sales tax calculation - would result + # in incorrect or missing sales tax on invoices. + my $tax_district_method = FS::Conf->new->config('tax_district_method'); + if ( + $tax_district_method + && $tax_district_method eq 'wa_sales' + && $self->district + ) { + my $cust_main_county = qsearchs( + cust_main_county => { district => $self->district } + ); + unless ( ref $cust_main_county ) { + return sprintf ( + 'WA State tax district %s does not exist in tax table', + $self->district + ); + } + } + unless ( $import or qsearch('cust_main_county', { 'country' => $self->country, 'state' => '',