1 % if ($cgi->param('popup')) {
2 % my $title = $error ? 'Error sending invoice email' : 'Invoice email sent';
3 <% include('/elements/header-popup.html', $title ) %>
4 <DIV STYLE="text-align: center;">
5 <SPAN STYLE="color: red; font-weight: bold;"><% $error %></SPAN><BR>
6 <BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON>
8 <% include('/elements/footer.html') %>
12 <% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %>
16 my %method = ( map { $_=>1 } qw( email print fax_invoice ) );
22 unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices');
24 my $invnum = $cgi->param('invnum');
25 my $template = $cgi->param('template');
26 my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name');
27 my $method = $cgi->param('method');
28 my $no_coupon = $cgi->param('no_coupon');
30 if ( $cgi->param('mode') =~ /^(\d+)$/ ) {
34 $method .= '_invoice' if $method eq 'fax'; #!
36 die "unknown method $method" unless $method{$method};
38 my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
39 die "Can't find invoice!\n" unless $cust_bill;
41 $cust_bill->set('mode' => $mode) if $mode;
43 #these methods die instead of return errors, so, handle that without a backtrace
44 eval { $cust_bill->$method({ 'template' => $template,
45 'notice_name' => $notice_name,
46 'no_coupon' => $no_coupon,
51 my $custnum = $cust_bill->getfield('custnum');