X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_refund.html;h=d5f5eb2321cdf3b2c52f8964be09ab25ae283a3b;hp=557e0ab243dbfe2a3b43d7cac769cb137954cdf7;hb=f822e27a1e00594332ffa487a1c284234c5580a6;hpb=46a7257273fdae101658c8a1ee74f654ca0876b5 diff --git a/httemplate/view/cust_refund.html b/httemplate/view/cust_refund.html index 557e0ab24..d5f5eb232 100644 --- a/httemplate/view/cust_refund.html +++ b/httemplate/view/cust_refund.html @@ -1,83 +1,93 @@ % if ( $link eq 'popup' ) { - <% include('/elements/header-popup.html', "Refund Receipt" ) %> + <& /elements/header-popup.html, mt('Refund Receipt') &> -
Print

+
+ <% mt('Print') |h %> +% if ( $cust_main->invoicing_list_emailonly ) { + | <% mt('Email') |h %> +% } +
% } elsif ( $link eq 'print' ) { - <% include('/elements/header-popup.html', "Refund Receipt" ) %> + <& /elements/header-popup.html, mt('Refund 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', "Refund Receipt", menubar( - "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - 'Print receipt' => $pr_link, - )) - %> + <& /elements/header.html, mt('Refund 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) %> - Refund# + <% mt('Refund #') |h %> <% $cust_refund->refundnum %> - Date + <% mt('Date') |h %> <% time2str"%a %b %o, %Y %r", $cust_refund->_date %> - Amount + <% mt('Amount') |h %> <% $money_char. $cust_refund->refund %> - Reason + <% mt('Reason') |h %> <% $cust_refund->reason %> - Refund method + <% mt('Refund method') |h %> <% $cust_refund->payby_name %><% $cust_refund->paymask ? ' #'.$cust_refund->paymask : '' %> -% if ( $cust_refund->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_refund->paybatch ) { +% if ( $cust_refund->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_refund->processor ) { - Processor + <% mt('Processor') |h %> <% $cust_refund->processor %> - Authorization# - <% $cust_refund->authorization %> + <% mt('Authorization #') |h %> + <% $cust_refund->auth %> % if ( $cust_refund->order_number ) { - Order# + <% mt('Order #') |h %> <% $cust_refund->order_number %> % } @@ -92,13 +102,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> @@ -106,10 +121,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'); - #'View customer refunds' ??? - + unless $curuser->access_right('View invoices') #remove this in 2.5 (2.7?) + || $curuser->access_right('View refunds'); $cgi->param('refundnum') =~ /^(\d+)$/ or die "no refundnum"; my $refundnum = $1; @@ -128,9 +141,13 @@ my $cust_refund = qsearchs({ }); die "Refund #$refundnum not found!" unless $cust_refund; +my $cust_main = $cust_refund->cust_main; + my $pr_link = "${p}view/cust_refund.html?link=print;refundnum=$refundnum"; +my $email_link = "${p}view/cust_refund.html?link=email;refundnum=$refundnum"; my $custnum = $cust_refund->custnum; +my $display_custnum = $cust_main->display_custnum; my $conf = new FS::Conf; @@ -138,4 +155,11 @@ 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_refund->send_receipt( 'cust_main' => $cust_main ); + warn "can't send refund receipt: $email_error" if $email_error; +} +