From a7f9cf427287a825fdc0911f93fa79b0512ff88d Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 18 Oct 2008 01:08:27 +0000 Subject: [PATCH] cope with overlapping (but with distinct endpoints) tax areas --- FS/FS/cust_main.pm | 19 ++++++++++--------- 1 file 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; } -- 2.20.1