From 2ecef68b926eae756524a564bd0986da7b56109f Mon Sep 17 00:00:00 2001 From: levinse Date: Thu, 4 Nov 2010 00:54:36 +0000 Subject: [PATCH] added an e-mail link on payment receipts, RT7946 --- httemplate/view/cust_pay.html | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index 2f23d9e14..1408b3db2 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -2,7 +2,10 @@ <% include('/elements/header-popup.html', "$thing Receipt" ) %> -
Print

+
+ Print | + Re-email +

% } elsif ( $link eq 'print' ) { @@ -15,7 +18,12 @@ ) %>

- +% } elsif ( $link eq 'email' ) { +% if ( $email_error ) { + <% include('/elements/header-popup.html', "Error re-emailing receipt: $email_error" ) %> +% } else { + <% include('/elements/header-popup.html', "Re-emailed receipt" ) %> +% } % } else { <% include('/elements/header.html', "$thing Receipt", menubar( @@ -26,7 +34,7 @@ % } -% unless ($link eq 'popup' ) { +% unless ($link =~ /^(popup|email)$/ ) { <% include('/elements/small_custview.html', $custnum, scalar($conf->config('countrydefault')), @@ -110,9 +118,14 @@ window.print(); -% } +% } elsif ( $link eq 'email' ) { -% if ( $link =~ /^(popup|print)$/ ) { + + +% } +% if ( $link =~ /^(popup|print|email)$/ ) { % } else { @@ -149,6 +162,7 @@ my $cust_pay = qsearchs({ die "$thing #$paynum not found!" unless $cust_pay; my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void"; +my $email_link = "${p}view/cust_pay.html?link=email;paynum=$paynum;void=$void"; my $custnum = $cust_pay->custnum; my $display_custnum = $cust_pay->cust_main->display_custnum; @@ -159,4 +173,14 @@ my $money_char = $conf->config('money_char') || '$'; tie my %payby, 'Tie::IxHash', FS::payby->payby2longname; +my $email_error; + +if ( $link eq 'email' ) { + my $email_error = $cust_pay->send_receipt( + 'manual' => 1, + ); + + warn "can't send payment receipt/statement: $email_error" if $email_error; +} + -- 2.11.0