X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_pay.html;h=ba4cfdafc2f18a10e9a33d1ea2854935191c19fd;hp=2e2344d4056358d0e345b157b61e36ba05449b2f;hb=ff27c3f36240aee48ed50153dd5d8fe3ac3f2443;hpb=8d029daaa89e10b9a3e320cccfaad14714e19581 diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index 2e2344d40..ba4cfdafc 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -1,81 +1,134 @@ % if ( $link eq 'popup' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <& /elements/header-popup.html, mt("$thing Receipt") &> -
Print

+
+ <% mt('Print') |h %> +% if ( $cust_main->invoicing_list_emailonly ) { + | <% mt('Re-email') |h %> +% } +

% } elsif ( $link eq 'print' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <& /elements/header-popup.html, mt("$thing Receipt") &> % #it would be nice if the menubar could be hidden for print, but better to % # have it available than not, otherwise the user winds up at a dead end <% menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum", ) %>

- +% } elsif ( $link eq 'email' ) { +% if ( $email_error ) { + <& /elements/header-popup.html, mt("Error re-emailing receipt: [_1]", $email_error) &> +% } else { + <& /elements/header-popup.html, mt("Re-emailed receipt") &> +% } % } else { - <% include('/elements/header.html', "Payment Receipt", menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Print receipt' => $pr_link, - )) - %> + <& /elements/header.html, mt("$thing Receipt"), menubar( + emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum", + emt('Print receipt') => $pr_link, + ) + &> % } -% unless ($link eq 'popup' ) { - <% include('/elements/small_custview.html', +% unless ($link =~ /^(popup|email)$/ ) { + <& /elements/small_custview.html, $custnum, scalar($conf->config('countrydefault')), 1, #no balance - ) - %> + &>

% } <% ntable("#cccccc", 2) %> - Payment# + <% mt('Payment #') |h %> <% $cust_pay->paynum %> - Date + <% mt('Date') |h %> <% time2str"%a %b %o, %Y %r", $cust_pay->_date %> +% if ( $void ) { + + + <% mt('Void Date') |h %> + <% time2str"%a %b %o, %Y %r", $cust_pay->void_date %> + + +%# +%# <% mt('Void reason') |h %> +%# <% $cust_pay->reason %> +%# + +% } - Amount + <% mt('Amount') |h %> <% $money_char. $cust_pay->paid %> - - Payment method + <% mt('Payment method') |h %> <% $cust_pay->payby_name %> #<% $cust_pay->paymask %> -% if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) { +% if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->processor ) { - Processor + <% mt('Processor') |h %> <% $cust_pay->processor %> - Authorization# - <% $cust_pay->authorization %> + <% mt('Authorization #') |h %> + <% $cust_pay->auth %> -% if ( $cust_pay->order_number ) { - - Order# - <% $cust_pay->order_number %> - -% } +% } + +% # API allows setting this for any payby +% if ( $cust_pay->order_number ) { + + <% mt('Order #') |h %> + <% $cust_pay->order_number %> + +% } + +% if ( $cust_pay->payby eq 'CASH' && $cust_pay->payinfo ) { + + <% mt('Bank') |h %> + <% $cust_pay->bank %> + + + + <% mt('Teller #') |h %> + <% $cust_pay->teller %> + + + + <% mt('Depositor') |h %> + <% $cust_pay->depositor %> + + + + <% mt('Account #') |h %> + <% $cust_pay->account %> + +% } + +% if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) { +% my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } ); + + <% mt('For package') |h %> + <% $cust_pkg->pkg_label_long %> + % } @@ -87,13 +140,18 @@ window.print(); -% } +% } elsif ( $link eq 'email' ) { + + -% if ( $link =~ /^(popup|print)$/ ) { +% } +% if ( $link =~ /^(popup|print|email)$/ ) { % } else { - <% include('/elements/footer.html') %> + <& /elements/footer.html &> % } <%init> @@ -101,8 +159,8 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY - || $curuser->access_right('View customer payments'); + unless $curuser->access_right('View invoices') #remove this in 2.5 (2.7?) + || $curuser->access_right('View payments'); $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum"; my $paynum = $1; @@ -112,18 +170,26 @@ if ( $cgi->param('link') =~ /^(\w+)$/ ) { $link = $1; } +my $void = $cgi->param('void') ? 1 : 0; +my $thing = $void ? 'Voided Payment' : 'Payment'; +my $table = $void ? 'cust_pay_void' : 'cust_pay'; + my $cust_pay = qsearchs({ - 'select' => 'cust_pay.*', - 'table' => 'cust_pay', + 'select' => "$table.*", + 'table' => $table, 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'paynum' => $paynum }, 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); -die "Payment #$paynum not found!" unless $cust_pay; +die "$thing #$paynum not found!" unless $cust_pay; -my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum"; +my $cust_main = $cust_pay->cust_main; + +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_main->display_custnum; my $conf = new FS::Conf; @@ -131,4 +197,15 @@ my $money_char = $conf->config('money_char') || '$'; tie my %payby, 'Tie::IxHash', FS::payby->payby2longname; +my $email_error; + +if ( $link eq 'email' ) { + $email_error = $cust_pay->send_receipt( + 'manual' => 1, + 'cust_main' => $cust_main, + ); + + warn "can't send payment receipt/statement: $email_error" if $email_error; +} +