diff options
author | Mitch Jackson <mitch@freeside.biz> | 2019-01-20 16:14:12 -0500 |
---|---|---|
committer | Mitch Jackson <mitch@freeside.biz> | 2019-01-20 16:44:06 -0500 |
commit | e5c397093b5ee87f4178f4479235101bb4431591 (patch) | |
tree | 1a269977c56825e79718a0448be999a6fd1b0d86 /FS/FS/cust_location.pm | |
parent | 9f179ee5fc7fc07a3f5e03ad1ad58cd3cadf1a56 (diff) |
RT# 80488 Validation on cust_location.district values
Diffstat (limited to 'FS/FS/cust_location.pm')
-rw-r--r-- | FS/FS/cust_location.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 4521bd3..a2bda71 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' => '', |