diff options
author | ivan <ivan> | 2006-08-25 19:30:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-08-25 19:30:52 +0000 |
commit | 7517eaa583bcb213b62dfd0c11288aa50a350e8a (patch) | |
tree | a1a123dfb5a048348775e237f64ea25f6417bf2f /httemplate/edit/cust_main/select-county.html | |
parent | b19266599870172bda0921df60020f0440854750 (diff) |
use GROUP BY instead of DISTINCT ON in the state and country queries for better cross-database compatibility, based on a preliminary patch from Jason Thomas
Diffstat (limited to 'httemplate/edit/cust_main/select-county.html')
-rw-r--r-- | httemplate/edit/cust_main/select-county.html | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html index 70939fca5..c9b64bf4f 100644 --- a/httemplate/edit/cust_main/select-county.html +++ b/httemplate/edit/cust_main/select-county.html @@ -1,25 +1,10 @@ -% -% -% my %opt = @_; -% foreach my $opt (qw( county state country prefix onchange disabled )) { -% $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); -% } -% -% my $sql = "SELECT COUNT(*) FROM cust_main_county". -% " WHERE county IS NOT NULL AND county != ''"; -% my $sth = dbh->prepare($sql) or die dbh->errstr; -% $sth->execute or die $sth->errstr; -% my $countyflag = $sth->fetchrow_arrayref->[0]; -% -% % if ( $countyflag ) { - <% include('/elements/xmlhttp.html', 'url' => $p.'misc/counties.cgi', 'subs' => [ $opt{'prefix'}. 'get_counties' ], ) -%> + %> <SCRIPT TYPE="text/javascript"> @@ -69,15 +54,14 @@ % 'country' => $opt{'country'}, % } % ) -% ) { -% - +% ) { <OPTION VALUE="<% $county %>"<% $county eq $opt{'county'} ? ' SELECTED' : '' %>><% $county %> -% } +% } </SELECT> + % } else { @@ -87,5 +71,18 @@ </SCRIPT> <INPUT TYPE="hidden" NAME="<% $opt{'prefix'} %>county" VALUE="<% $opt{'county'} %>"> + % } +<%init> +my %opt = @_; +foreach my $opt (qw( county state country prefix onchange disabled )) { + $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); +} + +my $sql = "SELECT COUNT(*) FROM cust_main_county". + " WHERE county IS NOT NULL AND county != ''"; +my $sth = dbh->prepare($sql) or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $countyflag = $sth->fetchrow_arrayref->[0]; +</%init> |