From f4ffa3596c3b8bfc9e862c2a7e8efc68f86207ab Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 12 Feb 2004 06:31:37 +0000 Subject: 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 --- httemplate/misc/email-invoice.cgi | 23 +++++++++++++++++++++++ httemplate/misc/print-invoice.cgi | 2 +- httemplate/view/cust_bill.cgi | 8 +++++++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 httemplate/misc/email-invoice.cgi (limited to 'httemplate') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi new file mode 100755 index 000000000..7ab1613ee --- /dev/null +++ b/httemplate/misc/email-invoice.cgi @@ -0,0 +1,23 @@ +<% + +my $conf = new FS::Conf; + +#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 = 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; + +my $custnum = $cust_bill->getfield('custnum'); +print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); + +%> 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!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 '

'; my $conf = new FS::Conf; if ( $conf->exists('invoice_latex') ) { -- cgit v1.2.1