1 % if ( $cgi->param('_type') =~ /^xml$/ ) {
4 <& elements/search.html,
5 'html_init' => $html_init,
8 'count_query' => $count_query,
11 'header' => [ 'zip code' ],
12 'xml_elements' => [ 'zip codes' ],
13 'no_field_elements' => 1,
14 'fields' => [ 'zip' ],
15 'url' => $opt{url} || '',
16 'really_disable_download' => 1,
20 % if ( $cgi->param('_type') =~ /^xml$/ ) {
25 my $curuser = $FS::CurrentUser::CurrentUser;
28 unless $curuser->access_right('List packages');
31 my $html_init = '<H2>Part V</H2>';
36 for ( qw(agentnum magic state) ) {
37 $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
39 $search_hash{'country'} = 'US';
40 $search_hash{'classnum'} = [ $cgi->param('classnum') ];
41 $search_hash{report_option} = $cgi->param('part5_report_option')
42 if $cgi->param('part5_report_option');
44 my $sql_query = FS::cust_pkg->search( { %search_hash,
49 my $count_query = delete($sql_query->{'count_query'});
50 $count_query =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
51 $count_query =~ s/ORDER BY [.\w]+//;