X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fchoose_tax_location.html;h=ac475c54ba793133b4c9fb14b380a37344f49827;hb=b5c4237a34aef94976bc343c8d9e138664fc3984;hp=045490b5593f861ff1cf0b01e0757525e9198969;hpb=69676e2af001ffd5eec980bf977cc447c11ac3a9;p=freeside.git diff --git a/httemplate/edit/cust_main/choose_tax_location.html b/httemplate/edit/cust_main/choose_tax_location.html index 045490b55..ac475c54b 100644 --- a/httemplate/edit/cust_main/choose_tax_location.html +++ b/httemplate/edit/cust_main/choose_tax_location.html @@ -1,20 +1,25 @@

Choose tax location

+

the geocode is:<% $header %>

<% $header %>



- - + +
@@ -32,22 +37,24 @@ <%init> my $conf = new FS::Conf; -my $have_selected = 0; -my ($data_vendor) = $cgi->param('data_vendor') =~ /^([-\w]+)$/; -my ($city) = $cgi->param('city') =~ /^([\w ]+)$/; -my ($state) = $cgi->param('state') =~ /^(\w+)$/; -my ($zip) = $cgi->param('zip') =~ /^([-\w]+)$/; +my %location = (); -my($zip5, $zip4) = split('-', $zip); +($location{data_vendor}) = $cgi->param('data_vendor') =~ /^([-\w]+)$/; +($location{city}) = $cgi->param('city') =~ /^([\w ]+)$/; +($location{state}) = $cgi->param('state') =~ /^(\w+)$/; +($location{zip}) = $cgi->param('zip') =~ /^([-\w ]+)$/; +($location{country}) = $cgi->param('country') =~ /^([\w ]+)$/; -my $hashref = { data_vendor => $data_vendor, - #city => $city, - #state => $state, - zip => $zip5, - }; -#my @keys = qw ( city state zip ); -my @keys = qw ( zip ); +my($geocode) = $cgi->param('geocode') =~ /^([\w]+)$/; + +my($zip5, $zip4) = split('-', $location{zip}); + +#only support US & CA +my $hashref = { 'data_vendor' => $location{data_vendor} }; +$hashref->{zip} = $location{country} eq 'CA' ? substr($zip5,0,1) : $zip5, + +my @keys = keys(%$hashref); my @cust_tax_location = (); until ( @cust_tax_location ) { @cust_tax_location = qsearch({ table => 'cust_tax_location', @@ -65,7 +72,10 @@ foreach my $location (@cust_tax_location) { $max{$_} = ($length > $max{$_}) ? $length : $max{$_}; } } -$max{$_}++ foreach qw( city county state ); +foreach ( qw( city county state ) ) { + $max{$_} = $location{$_} if $location{$_} > $max{$_}; + $max{$_}++; +} my $header = '  '; $header .= $_. ' ' x ( $max{lc($_)} - length($_) )