Added support for FAX invoice destinations using a HylaFAX server.
[freeside.git] / httemplate / view / cust_bill.cgi
index bda5d76..c217cc3 100755 (executable)
@@ -7,6 +7,8 @@ $query =~ /^((.+)-)?(\d+)$/;
 my $templatename = $2;
 my $invnum = $3;
 
+my $conf = new FS::Conf;
+
 my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
 die "Invoice #$invnum not found!" unless $cust_bill;
 my $custnum = $cust_bill->getfield('custnum');
@@ -27,9 +29,11 @@ if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) {
         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>';
 
-my $conf = new FS::Conf;
 if ( $conf->exists('invoice_latex') ) {
   my $link = "${p}view/cust_bill-pdf.cgi?";
   $link .= "$templatename-" if $templatename;
@@ -47,7 +51,7 @@ unless ( $templatename ) {
     sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
   ) {
     my $status = $cust_bill_event->status;
-    $status .= ': '. $cust_bill_event->statustext
+    $status .= ': '. encode_entities($cust_bill_event->statustext)
       if $cust_bill_event->statustext;
     my $part_bill_event = $cust_bill_event->part_bill_event;
     print '<TR><TD>'. $part_bill_event->event;
@@ -70,8 +74,7 @@ unless ( $templatename ) {
   print '</TABLE><BR>';
 }
 
-
-print '<PRE>'. $cust_bill->print_text('', $templatename);
+print '<PRE>', $cust_bill->print_text('', $templatename);
 
        #formatting
        print <<END;