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 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 httemplate/misc/email-invoice.cgi (limited to 'httemplate/misc/email-invoice.cgi') 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"); + +%> -- cgit v1.2.1 From 1cd72a6f1bd5ca39410f525779f5ca4ee9228a1c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 3 Jun 2004 10:09:08 +0000 Subject: also fix agent-specific From: address on "re-email" link --- httemplate/misc/email-invoice.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/email-invoice.cgi') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index 7ab1613ee..a560a1838 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -10,7 +10,7 @@ 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'), + 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'), 'to' => [ grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ], 'subject' => 'Invoice', 'body' => [ $cust_bill->print_text ], -- cgit v1.2.1 From 821c540a2d41f633b1a4e1cd8bda82b8b2ff60de Mon Sep 17 00:00:00 2001 From: khoff Date: Thu, 17 Mar 2005 21:41:36 +0000 Subject: Added options invoice_email_pdf and invoice_email_pdf_note. invoice_email_pdf - Attach PDF invoice to emailed plain text invoices. invoice_email_pdf_note - Replace plain text invoice with this note, when attaching a PDF. --- httemplate/misc/email-invoice.cgi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'httemplate/misc/email-invoice.cgi') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index a560a1838..a3130c79f 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -10,10 +10,9 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; my $error = send_email( - 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'), - 'to' => [ grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ], - 'subject' => 'Invoice', - 'body' => [ $cust_bill->print_text ], + $cust_bill->generate_email( + 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'), + ) ); eidiot($error) if $error; -- cgit v1.2.1 From c28a4c33a88dfa354436f81a2e213638088adcf1 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 19 May 2005 08:43:27 +0000 Subject: re-email/fax/print links should respect template, also add direct re-send links like the view links and convert view/cust_bill.cgi to proper template --- httemplate/misc/email-invoice.cgi | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'httemplate/misc/email-invoice.cgi') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index a3130c79f..34afa9084 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -4,14 +4,17 @@ my $conf = new FS::Conf; #untaint invnum my($query) = $cgi->keywords; -$query =~ /^(\d*)$/; -my $invnum = $1; +$query =~ /^((.+)-)?(\d+)$/; +my $template = $2; +my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; my $error = send_email( $cust_bill->generate_email( - 'from' => $cust_bill->_agent_invoice_from || $conf->config('invoice_from'), + 'from' => + ( $cust_bill->_agent_invoice_from || $conf->config('invoice_from') ), + 'template' => $template, ) ); eidiot($error) if $error; -- cgit v1.2.1 From 684a478c0f88e5bf6d1d3f32f4618089146b5709 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 2 Jun 2005 09:29:56 +0000 Subject: add ability to search on a date range of invoice events and then reprint or reemail (boy was that a bit more work than i expected), closes: Bug#946 --- httemplate/misc/email-invoice.cgi | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'httemplate/misc/email-invoice.cgi') diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index 34afa9084..ad9ba1abb 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -1,7 +1,5 @@ <% -my $conf = new FS::Conf; - #untaint invnum my($query) = $cgi->keywords; $query =~ /^((.+)-)?(\d+)$/; @@ -10,16 +8,10 @@ my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; -my $error = send_email( - $cust_bill->generate_email( - 'from' => - ( $cust_bill->_agent_invoice_from || $conf->config('invoice_from') ), - 'template' => $template, - ) -); -eidiot($error) if $error; +$cust_bill->email($template); my $custnum = $cust_bill->getfield('custnum'); + print $cgi->redirect("${p}view/cust_main.cgi?$custnum"); %> -- cgit v1.2.1