summaryrefslogtreecommitdiff
path: root/httemplate/misc/email-statement.cgi
blob: 67f654d648684545ab555063baadd9a9bf0d1dc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices');

#untaint statementnum
my($query) = $cgi->keywords;
$query =~ /^((.+)-)?(\d+)$/;
my $template = $2 || 'statement'; #XXX configure... via event??  eh..
my $statementnum = $3;
my $cust_statement = qsearchs('cust_statement',{'statementnum'=>$statementnum});
die "Can't find statement!\n" unless $cust_statement;

$cust_statement->email($template); 

my $custnum = $cust_statement->getfield('custnum');

</%init>