X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2F477partV.html;h=0987fea443922b62710c4211e55a3086fb798fb0;hb=8c450aab9bae89373c2c1b35c85597bb52299de3;hp=885294d289e210f763840eeca0a3ac2ba6024a20;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html index 885294d28..0987fea44 100755 --- a/httemplate/search/477partV.html +++ b/httemplate/search/477partV.html @@ -1,7 +1,7 @@ <% include( 'elements/search.html', 'html_init' => $html_init, 'name' => 'zip code', - 'query' => [ @sql_query ], + 'query' => $sql_query, 'count_query' => $count_query, 'nohtmlheader' => 1, 'disable_total' => 1, @@ -10,6 +10,7 @@ 'no_field_elements' => 1, 'fields' => [ 'zip' ], 'url' => $opt{url} || '', + 'disable_download' => 1, ) %> @@ -26,28 +27,20 @@ my %search_hash = (); my @sql_query = (); my @count_query = (); -for ( qw(agentnum magic classnum) ) { +for ( qw(agentnum magic) ) { $search_hash{$_} = $cgi->param($_) if $cgi->param($_); } - -my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' > 1 }); -$sql_query->{select} = 'DISTINCT zip'; -$sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//; -push @sql_query, $sql_query; -push @count_query, delete($sql_query->{'count_query'}); -$count_query[0] =~ s/count\(\*\)/count(DISTINCT zip)/; -$count_query[0] =~ s/ORDER BY [.\w]+//; - -$search_hash{classnum} = $cgi->param('part2a_classnum') - if $cgi->param('part2a_classnum'); - -$sql_query = FS::cust_pkg->search( { %search_hash } ); -$sql_query->{select} = 'DISTINCT zip'; -$sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//; -push @sql_query, $sql_query; -push @count_query, delete($sql_query->{'count_query'}); -$count_query[1] =~ s/count\(\*\)/count(DISTINCT zip)/; -$count_query[1] =~ s/ORDER BY [.\w]+//; -my $count_query = join(' UNION ', @count_query); +$search_hash{'classnum'} = [ $cgi->param('classnum') ]; +$search_hash{report_option} = $cgi->param('partv_report_option') + if $cgi->param('partv_report_option'); + +my $sql_query = FS::cust_pkg->search( { %search_hash, + 'fcc_line' => 1, + 'select_zip5' => 1, + } + ); +my $count_query = delete($sql_query->{'count_query'}); +$count_query =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/; +$count_query =~ s/ORDER BY [.\w]+//;