fix A/R report
[freeside.git] / httemplate / elements / email-link.html
index 692e5bc..16935cf 100644 (file)
@@ -1,15 +1,17 @@
 % if ( $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices') ) {
-<A HREF="<%$p%>misc/email-customers.html?table=<%$table%>&<%$query%>"><%$label%></A>
+<A HREF="<%$p%>misc/email-customers.html?table=<%$table%>&agent_virt_agentnum=<%$agent_virt_agentnum%>&<%$query%>"><%$label%></A>
 % }
 <%init>
 my %opt = @_;
 my $table = $opt{'table'};
+my $agent_virt_agentnum = $opt{'agent_virt_agentnum'};
 my $search_hash = $opt{'search_hash'};
 die "'table' required" if !$table;
 die "'search_hash' required" if !$search_hash;
 
 my $uri = new URI;
-$uri->query_form($search_hash);
+my @params = map { $_, $search_hash->{$_} } sort keys %$search_hash;
+$uri->query_form(@params);
 my $query = $uri->query;
 my $label = ($opt{'label'} || 'Email a notice to these customers');
 </%init>