X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill.cgi;h=c217cc3896205bf886880df592963b11954358c9;hb=18c025613fa052cf4ba8d484f1296cc2a1719a24;hp=4d98f3ebc8fb53683a29d36ed6e816d8317a0cf1;hpb=13481802b29a511fa0aa1d10e2ad463e362bf8ed;p=freeside.git diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 4d98f3ebc..c217cc389 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -3,8 +3,11 @@ #untaint invnum my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $invnum = $1; +$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; @@ -20,30 +23,58 @@ print header('Invoice View', menubar( print qq!Enter payments (check/cash) against this invoice | ! if $cust_bill->owed > 0; -print qq!Reprint this invoice!. '

'; +print qq!Reprint this invoice!; +if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { + print qq! | !. + qq!Re-email this invoice!; +} + +print qq! | Refax this invoice! + if ($conf->exists('hylafax')); + +print '

'; -my $conf = new FS::Conf; 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' => "${p}view/cust_bill-pdf.cgi?$invnum", + 'View typeset invoice' => $link, ), '

'; } #false laziness with search/cust_bill_event.cgi -print table(). 'EventDateStatus'; -foreach my $cust_bill_event ( - sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event -) { - my $status = $cust_bill_event->status; - $status .= ': '. $cust_bill_event->statustext if $cust_bill_event->statustext; - print ''. $cust_bill_event->part_bill_event->event. ''. - time2str("%a %b %e %T %Y", $cust_bill_event->_date). ''. - $status. ''; +unless ( $templatename ) { + print table(). 'EventDateStatus'; + foreach my $cust_bill_event ( + sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event + ) { + my $status = $cust_bill_event->status; + $status .= ': '. encode_entities($cust_bill_event->statustext) + if $cust_bill_event->statustext; + my $part_bill_event = $cust_bill_event->part_bill_event; + print ''. $part_bill_event->event; + + if ( + $part_bill_event->plan eq 'send_alternate' + && $part_bill_event->plandata =~ /^templatename (.*)$/m + ) { + my $templatename = $1; + print qq! ( !. + 'view text | '. + qq!!. + 'view typeset )'; + } + + print ''. + time2str("%a %b %e %T %Y", $cust_bill_event->_date). ''. + $status. ''; + } + print '
'; } -print '
';
 
-print $cust_bill->print_text;
+print '
', $cust_bill->print_text('', $templatename);
 
 	#formatting
 	print <