From: jeff Date: Sat, 18 Oct 2008 01:08:27 +0000 (+0000) Subject: cope with overlapping (but with distinct endpoints) tax areas X-Git-Tag: root_of_webpay_support~308 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;ds=sidebyside;h=a7f9cf427287a825fdc0911f93fa79b0512ff88d;p=freeside.git cope with overlapping (but with distinct endpoints) tax areas --- 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; }