X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2F477partVI_census.html;h=53b6db0629d013dc583a360a94a7e271e077f507;hb=6c135249a792decae9f8f98eda5ee4077efcdb34;hp=9134baccaec546fa5b6bf72dd0cd4ebede8023d2;hpb=1d15c6930650f2cceb13f7ae9da4acea5213643f;p=freeside.git diff --git a/httemplate/search/477partVI_census.html b/httemplate/search/477partVI_census.html index 9134bacca..53b6db062 100755 --- a/httemplate/search/477partVI_census.html +++ b/httemplate/search/477partVI_census.html @@ -1,13 +1,6 @@ <% include( 'elements/search.html', 'html_init' => $html_init, - 'html_foot' => sub { if (scalar(keys %state_hash) > 1) { - '
'. - 'WARNING: multiple states found'. - '
'; - } else { - ''; - } - }, + 'html_foot' => $html_foot,, 'name' => 'regions', 'query' => [ @sql_query ], 'count_query' => $count_query, @@ -37,14 +30,16 @@ ], 'fields' => [ sub { my $row = shift; - $state_hash{substr($row->censustract, 0, 2)} = 1; - substr($row->censustract, 2, 3) + $state_hash{substr($row->censustract, 0, 2)}++; + substr($row->censustract, 2, 3) || 'none' + }, + sub { my $row = shift; + substr($row->censustract, 5) || 'none' }, - sub { my $row = shift; substr($row->censustract, 5) }, 'upload', 'download', 'technology_code', - sub { $cgi->param('_type') eq 'xml' ? '0' : '' }, # doesn't really work + sub { $cgi->param('_type') eq 'xml' ? '0' : '' },#broken 'quantity', sub { my $row = shift; sprintf "%.2f", $row->residential }, ], @@ -130,8 +125,16 @@ my $count_query = 'SELECT count(*) FROM ( ('. @sql_query ). ') ) AS foo'; -my $link = 'cust_pkg.cgi?'. - join(';', map{ "$_=". $search_hash{$_} } keys %search_hash). ';'; +my $link = 'cust_pkg.cgi?'. join(';', + map { my $key = $_; + my @values = ref($search_hash{$_}) + ? @{ $search_hash{$_} } + : $search_hash{$_}; + map { "$key=$_" } @values; + } + keys %search_hash + ). ';'; + my $link_suffix = sub { my $row = shift; my $result = 'censustract='. $row->censustract. ';'; $result .= 'report_option='. @row_option[$row->upload - 1] @@ -140,4 +143,23 @@ my $link_suffix = sub { my $row = shift; if @column_option[$row->download - 1]; $result; }; + +my $html_foot = sub { + if (scalar(keys %state_hash) > 1) { + '
WARNING: multiple states found
'. + ''. #nicer formatting someday + join('', map { ''. + "". + qq('. + ''; + } + keys %state_hash + ). + '
$_). + $state_hash{$_}. '
'; + } else { + ''; + } +}; +