diff options
| author | ivan <ivan> | 2004-02-12 06:31:39 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2004-02-12 06:31:39 +0000 | 
| commit | 795f1508db74c47a42cf947be9401c6db9b61083 (patch) | |
| tree | b1ae994a959c13b86ead2e2105a5c4ac165eca68 | |
| parent | 1158b98b59803b3bc05a38f73e639fc6b2b8799e (diff) | |
re-email invoice, closes: bug#526 and have print and email invoice links redirect back to top of customer view page instead of #history tag
| -rw-r--r-- | htetc/global.asa | 1 | ||||
| -rw-r--r-- | htetc/handler.pl | 1 | ||||
| -rwxr-xr-x | httemplate/misc/email-invoice.cgi | 22 | ||||
| -rwxr-xr-x | httemplate/misc/print-invoice.cgi | 2 | ||||
| -rwxr-xr-x | httemplate/view/cust_bill.cgi | 8 | 
5 files changed, 24 insertions, 10 deletions
| diff --git a/htetc/global.asa b/htetc/global.asa index 3d9aae437..528f02a91 100644 --- a/htetc/global.asa +++ b/htetc/global.asa @@ -17,6 +17,7 @@ use FS::Conf;  use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot                 small_custview myexit http_header);  use FS::Msgcat qw(gettext geterror); +use FS::Misc qw( send_email );  use FS::agent;  use FS::agent_type; diff --git a/htetc/handler.pl b/htetc/handler.pl index d7b41139d..692140817 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -79,6 +79,7 @@ sub handler        use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot                       small_custview myexit http_header);        use FS::Msgcat qw(gettext geterror); +      use FS::Misc qw( send_email );        use FS::agent;        use FS::agent_type; diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index 7ab1613ee..0dda68a4e 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -1,6 +1,7 @@  <%  my $conf = new FS::Conf; +my $lpr = $conf->config('lpr');  #untaint invnum  my($query) = $cgi->keywords; @@ -9,15 +10,20 @@ my $invnum = $1;  my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});  die "Can't find invoice!\n" unless $cust_bill; -my $error = send_email( -  'from'    => $conf->config('invoice_from'), -  'to'      => [ grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ], -  'subject' => 'Invoice', -  'body'    => [ $cust_bill->print_text ], -); -eidiot($error) if $error; +        open(LPR,"|$lpr") or die "Can't open $lpr: $!"; + +        if ( $conf->exists('invoice_latex') ) { +          print LPR $cust_bill->print_ps; #( date ) +        } else { +          print LPR $cust_bill->print_text; #( date ) +        } + +        close LPR +          or die $! ? "Error closing $lpr: $!" +                       : "Exit status $? from $lpr";  my $custnum = $cust_bill->getfield('custnum'); -print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); + +print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history");  %> diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index 0dda68a4e..144f6156a 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -24,6 +24,6 @@ die "Can't find invoice!\n" unless $cust_bill;  my $custnum = $cust_bill->getfield('custnum'); -print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum#history"); +print $cgi->redirect("${p}view/cust_main.cgi?$custnum");  %> diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 4d98f3ebc..50ee8b36c 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -20,7 +20,13 @@ print header('Invoice View', menubar(  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>!.      '<BR><BR>'; +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 '<BR><BR>';  my $conf = new FS::Conf;  if ( $conf->exists('invoice_latex') ) { | 
