From 18c025613fa052cf4ba8d484f1296cc2a1719a24 Mon Sep 17 00:00:00 2001 From: khoff Date: Mon, 21 Mar 2005 22:13:39 +0000 Subject: Added support for FAX invoice destinations using a HylaFAX server. Faxing plain text invoices is not supported. --- httemplate/docs/install.html | 1 + httemplate/edit/cust_main.cgi | 7 +++++-- httemplate/edit/process/cust_main.cgi | 1 + httemplate/misc/fax-invoice.cgi | 25 +++++++++++++++++++++++++ httemplate/view/cust_bill.cgi | 6 +++++- httemplate/view/cust_main/billing.html | 8 +++++++- httemplate/view/cust_main/tickets.html | 2 +- 7 files changed, 45 insertions(+), 5 deletions(-) create mode 100755 httemplate/misc/fax-invoice.cgi (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index eaebcde2b..10c51e77d 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -68,6 +68,7 @@ Before installing, you need:
  • Frontier::RPC (Frontier::RPC2)
  • MIME::Entity (MIME-tools) +
  • Fax::Hylafax::Client (Required if using FAX invoice destinations
  • Apache::DBI (optional but recommended for better webinterface performance) diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 3910b4b84..61468f382 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -302,8 +302,11 @@ if ( $payby_default eq 'HIDE' ) { print qq! CHECKED! if ( ! @invoicing_list && ! $conf->exists('disablepostalinvoicedefault') ) || grep { $_ eq 'POST' } @invoicing_list; - print qq!>Postal mail invoice!; - my $invoicing_list = join(', ', grep { $_ ne 'POST' } @invoicing_list ); + print qq!>Postal mail invoice!; + print qq!FAX invoice!; + my $invoicing_list = join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ); print qq!Email invoice !; print "Billing type", diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index a1d36986d..d2773a60e 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -25,6 +25,7 @@ if ( $payby ) { my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); +push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX'); $cgi->param('invoicing_list', join(',', @invoicing_list) ); diff --git a/httemplate/misc/fax-invoice.cgi b/httemplate/misc/fax-invoice.cgi new file mode 100755 index 000000000..46b2a1721 --- /dev/null +++ b/httemplate/misc/fax-invoice.cgi @@ -0,0 +1,25 @@ +<% + +my $conf = new FS::Conf; +my $lpr = $conf->config('lpr'); + +#untaint invnum +my($query) = $cgi->keywords; +$query =~ /^(\d*)$/; +my $invnum = $1; +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); +die "Can't find invoice!\n" unless $cust_bill; + + +my $error = &FS::Misc::send_fax( + dialstring => $cust_bill->cust_main->getfield('fax'), + docdata => [ $cust_bill->print_ps ], +); + +die $error if $error; + +my $custnum = $cust_bill->getfield('custnum'); + +print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); + +%> diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index ca0612d09..c217cc389 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -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!; } +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; diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 18a203bd6..561fff992 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -16,10 +16,16 @@ Billing information <%= ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %> + + FAX invoices + + <%= ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %> + + Email invoices - <%= join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no' %> + <%= join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %> diff --git a/httemplate/view/cust_main/tickets.html b/httemplate/view/cust_main/tickets.html index d6ddfa64c..ea70d701d 100644 --- a/httemplate/view/cust_main/tickets.html +++ b/httemplate/view/cust_main/tickets.html @@ -30,7 +30,7 @@ Highest priority tickets (View all tickets for this customer) -(New ticket for this customer) +(New ticket for this customer) <%= table() %> # -- cgit v1.2.1