summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2019-01-19 07:41:08 -0500
committerMitch Jackson <mitch@freeside.biz>2019-01-19 08:57:32 -0500
commit569f676f4a06512a46120e12edc6a6410e93ff93 (patch)
treefa6d58552c6d34b24cb7daf8a29430b70e8db2a8 /FS
parent39fe6499bd38e6e7c468f549b1d4919a7cf2c44d (diff)
RT# 80488 Live look up of WA state tax district
When conf flag 'tax_district_method' is set, tax district is queried for address before form is submitted Affected Pages: * New Customer * Edit Customer * Order Package * Change Package * Edit Package Location
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_location.pm17
-rw-r--r--FS/FS/cust_main.pm14
2 files changed, 14 insertions, 17 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index fee77a8..63492dd 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -265,8 +265,15 @@ sub insert {
return $error;
}
- #false laziness with cust_main, will go away eventually
- if ( !$import and $conf->config('tax_district_method') ) {
+ # If using tax_district_method, for rows in state of Washington,
+ # without a tax district already specified, queue a job to find
+ # the tax district
+ if (
+ !$import
+ && !$self->district
+ && lc $self->state eq 'wa'
+ && $conf->config('tax_district_method')
+ ) {
my $queue = new FS::queue {
'job' => 'FS::geocode_Mixin::process_district_update'
@@ -990,7 +997,11 @@ sub _upgrade_data {
die "$error (fixing whitespace in $field, locationnum ".$location->locationnum.')'
if $error;
- if ( $use_districts ) {
+ if (
+ $use_districts
+ && !$location->district
+ && lc $location->state eq 'wa'
+ ) {
my $queue = new FS::queue {
'job' => 'FS::geocode_Mixin::process_district_update'
};
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index cc0e83f..920f4d4 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -743,20 +743,6 @@ sub insert {
}
}
- # FS::geocode_Mixin::after_insert or something?
- if ( $conf->config('tax_district_method') and !$import ) {
- # if anything non-empty, try to look it up
- my $queue = new FS::queue {
- 'job' => 'FS::geocode_Mixin::process_district_update',
- 'custnum' => $self->custnum,
- };
- my $error = $queue->insert( ref($self), $self->custnum );
- if ( $error ) {
- $dbh->rollback if $oldAutoCommit;
- return "queueing tax district update: $error";
- }
- }
-
# cust_main exports!
warn " exporting\n" if $DEBUG > 1;