summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2008-10-18 01:08:27 +0000
committerjeff <jeff>2008-10-18 01:08:27 +0000
commita7f9cf427287a825fdc0911f93fa79b0512ff88d (patch)
treed051a97906ae0dd032dc5f1c9073b40f5fe2a076
parent10af4c3d4345d7cedb47c4b55241d92a60e01ce5 (diff)
cope with overlapping (but with distinct endpoints) tax areas
-rw-r--r--FS/FS/cust_main.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 61cb75daf..f6952050d 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -5188,15 +5188,16 @@ sub geocode {
my $extra_sql = "AND plus4lo <= '$plus4' AND plus4hi >= '$plus4'";
my $geocode = '';
- my $cust_tax_location =
- qsearchs( {
- 'table' => 'cust_tax_location',
- 'hashref' => { 'zip' => $zip, 'data_vendor' => $data_vendor },
- 'extra_sql' => $extra_sql,
- }
- );
- $geocode = $cust_tax_location->geocode
- if $cust_tax_location;
+ my @cust_tax_location =
+ qsearch( {
+ 'table' => 'cust_tax_location',
+ 'hashref' => { 'zip' => $zip, 'data_vendor' => $data_vendor },
+ 'extra_sql' => $extra_sql,
+ 'order_by' => 'plus4lo', #overlapping areas with distinct ends
+ }
+ );
+ $geocode = $cust_tax_location[0]->geocode
+ if scalar(@cust_tax_location);
$geocode;
}