1 <% include( 'elements/search.html',
2 'html_init' => $html_init,
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} || '',
13 'disable_download' => 1,
19 my $curuser = $FS::CurrentUser::CurrentUser;
22 unless $curuser->access_right('List packages');
25 my $html_init = '<H2>Part V</H2>';
30 for ( qw(agentnum magic) ) {
31 $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
33 $search_hash{'classnum'} = [ $cgi->param('classnum') ];
34 $search_hash{report_option} = $cgi->param('partv_report_option')
35 if $cgi->param('partv_report_option');
37 my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' => 1 });
38 $sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip';
39 $sql_query->{order_by} = 'ORDER BY substr(zip,1,5)';
40 my $count_query = delete($sql_query->{'count_query'});
41 $count_query =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
42 $count_query =~ s/ORDER BY [.\w]+//;