-));
-
-print qq!<A HREF="${p}edit/cust_pay.cgi?$invnum">Enter payments (check/cash) against this invoice</A> | !
- if $cust_bill->owed > 0;
-
-print qq!<A HREF="${p}misc/print-invoice.cgi?$invnum">Reprint this invoice</A>!;
-if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) {
- print qq! | <A HREF="${p}misc/email-invoice.cgi?$invnum">!.
- qq!Re-email this invoice</A>!;
-}
-
-print qq! | <A HREF="${p}misc/fax-invoice.cgi?$invnum">Refax this invoice</A>!
- if ($conf->exists('hylafax'));
-
-print '<BR><BR>';
-
-if ( $conf->exists('invoice_latex') ) {
- my $link = "${p}view/cust_bill-pdf.cgi?";
- $link .= "$templatename-" if $templatename;
- $link .= "$invnum.pdf";
- print menubar(
- 'View typeset invoice' => $link,
- ), '<BR><BR>';
-}
-
-#false laziness with search/cust_bill_event.cgi
-
-unless ( $templatename ) {
- print table(). '<TR><TH>Event</TH><TH>Date</TH><TH>Status</TH></TR>';
- foreach my $cust_bill_event (
- sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
- ) {
+)) %>
+
+<% if ( $cust_bill->owed > 0 ) { %>
+ <A HREF="<%= $p %>edit/cust_pay.cgi?<%= $invnum %>">Enter payments (check/cash) against this invoice</A> |
+<% } %>
+
+<A HREF="<%= $p %>misc/print-invoice.cgi?<%= $link %>">Reprint this invoice</A>
+
+<% if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { %>
+ | <A HREF="<%= $p %>misc/email-invoice.cgi?<%= $link %>">Re-email
+ this invoice</A>
+<% } %>
+
+<% if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { %>
+ | <A HREF="<%= $p %>misc/fax-invoice.cgi?<%= $link %>">Re-fax
+ this invoice</A>
+<% } %>
+
+<BR><BR>
+
+<% if ( $conf->exists('invoice_latex') ) { %>
+ <A HREF="<%= $p %>view/cust_bill-pdf.cgi?$link.pdf">View typeset invoice</A>
+ <BR><BR>
+<% } %>
+
+<% #false laziness with search/cust_bill_event.cgi
+ unless ( $templatename ) { %>
+
+ <%= table() %>
+ <TR>
+ <TH>Event</TH>
+ <TH>Date</TH>
+ <TH>Status</TH>
+ </TR>
+
+ <% foreach my $cust_bill_event (
+ sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
+ ) {
+