-<% include( 'elements/search.html',
+% if ( $cgi->param('_type') =~ /^xml$/ ) {
+<zip_code>
+% }
+<& elements/search.html,
'html_init' => $html_init,
'name' => 'zip code',
'query' => $sql_query,
'no_field_elements' => 1,
'fields' => [ 'zip' ],
'url' => $opt{url} || '',
- 'disable_download' => 1,
+ 'really_disable_download' => 1,
- )
-%>
+
+&>
+% if ( $cgi->param('_type') =~ /^xml$/ ) {
+</zip_code>
+% }
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
my @sql_query = ();
my @count_query = ();
-for ( qw(agentnum magic) ) {
+for ( qw(agentnum magic state) ) {
$search_hash{$_} = $cgi->param($_) if $cgi->param($_);
}
+$search_hash{'country'} = 'US';
$search_hash{'classnum'} = [ $cgi->param('classnum') ];
-$search_hash{report_option} = $cgi->param('partv_report_option')
- if $cgi->param('partv_report_option');
+$search_hash{report_option} = $cgi->param('part5_report_option')
+ if $cgi->param('part5_report_option');
-my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' => 1 });
-$sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip';
-$sql_query->{order_by} = 'ORDER BY substr(zip,1,5)';
+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]+//;
-warn "\ncount_query:\n$count_query\n\nsql_query:\n".Dumper($sql_query)."\n\n";
</%init>