diff options
author | ivan <ivan> | 2006-12-27 01:07:28 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-12-27 01:07:28 +0000 |
commit | 8e95986bf97e83e00b0375dd1517c4bd0afb23e5 (patch) | |
tree | bf313afe11c3b188acbc02bd647f5535a851c347 /httemplate/misc/counties.cgi | |
parent | 84191efb2ad13dd839372df7a948dc08a6bb5ff5 (diff) |
fix county selector
Diffstat (limited to 'httemplate/misc/counties.cgi')
-rw-r--r-- | httemplate/misc/counties.cgi | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/httemplate/misc/counties.cgi b/httemplate/misc/counties.cgi index c9eb98500..940cba7dc 100644 --- a/httemplate/misc/counties.cgi +++ b/httemplate/misc/counties.cgi @@ -1,18 +1,27 @@ -% -% -% my( $state, $country ) = $cgi->param('arg'); -% -% my @counties = -% sort -% map { s/[\n\r]//g; $_; } -% map { $_->county; } -% qsearch( 'cust_main_county', -% { 'state' => $state, -% 'country' => $country, -% }, -% ) -% ; -% -% -% [ <% join(', ', map { qq("$_") } @counties) %> ] +<%init> + +my $DEBUG = 0; + +my( $state, $country ) = $cgi->param('arg'); + +warn "fetching counties for $state / $country \n" + if $DEBUG; + +my @counties = + sort + map { s/[\n\r]//g; $_; } + map { $_->county; } + qsearch( { + 'select' => 'DISTINCT county', + 'table' => 'cust_main_county', + 'hashref' => { 'state' => $state, + 'country' => $country, + }, + } ) +; + +warn "counties: ". join(', ', map { qq("$_") } @counties). "\n" + if $DEBUG; + +</%init> |