1 <% include( 'elements/search.html',
2 'html_init' => $html_init,
4 'query' => [ @sql_query ],
5 'count_query' => $count_query,
8 'header' => [ 'zip code' ],
9 'xml_elements' => [ 'zip codes' ],
10 'no_field_elements' => 1,
11 'fields' => [ 'zip' ],
12 'url' => $opt{url} || '',
18 my $curuser = $FS::CurrentUser::CurrentUser;
21 unless $curuser->access_right('List packages');
24 my $html_init = '<H2>Part V</H2>';
29 for ( qw(agentnum magic) ) {
30 $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
32 $search_hash{'classnum'} = [ $cgi->param('classnum') ];
34 my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' > 1 });
35 $sql_query->{select} = 'DISTINCT zip';
36 $sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//;
37 push @sql_query, $sql_query;
38 push @count_query, delete($sql_query->{'count_query'});
39 $count_query[0] =~ s/count\(\*\)/count(DISTINCT zip)/;
40 $count_query[0] =~ s/ORDER BY [.\w]+//;
42 $search_hash{classnum} = $cgi->param('part2a_classnum')
43 if $cgi->param('part2a_classnum');
45 $sql_query = FS::cust_pkg->search( { %search_hash } );
46 $sql_query->{select} = 'DISTINCT zip';
47 $sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//;
48 push @sql_query, $sql_query;
49 push @count_query, delete($sql_query->{'count_query'});
50 $count_query[1] =~ s/count\(\*\)/count(DISTINCT zip)/;
51 $count_query[1] =~ s/ORDER BY [.\w]+//;
52 my $count_query = join(' UNION ', @count_query);