1 % my $title = $error ? 'Error printing and mailing invoice' : 'Invoice printed and mailed';
2 <% include('/elements/header-popup.html', $title ) %>
3 <DIV STYLE="text-align: center;">
4 <SPAN STYLE="color: red; font-weight: bold;"><% $error %></SPAN><BR>
5 <BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON>
7 <% include('/elements/footer-popup.html') %>
12 unless $FS::CurrentUser::CurrentUser->access_right('Print and mail invoices');
14 my $invnum = $cgi->param('invnum');
16 my $template = $cgi->param('template');
17 my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name');
18 my $no_coupon = $cgi->param('no_coupon');
21 my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum})
22 or die "Unknown invnum\n";
25 if ( $cgi->param('mode') =~ /^(\d+)$/ ) {
28 $cust_bill->set('mode' => $mode) if $mode;
30 #these methods die instead of return errors, so, handle that without a backtrace
33 eval { $cust_bill->postal_mail_fsinc( 'template' => $template,
34 'notice_name' => $notice_name,
35 'no_coupon' => $no_coupon,
40 $error ||= 'Unknown print and mail error: no letter ID returned'