X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpayment_history%2Fvoided_payment.html;h=e295f9b3b93ec85dc697f396ac9487289eef543a;hp=6103727213e469faac3ee94a560180863c08625e;hb=55c7e3cc18a45620f48ae62d3bc044a830bd8c95;hpb=63a268637b2d51a8766412617724b9436439deb6

diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html
index 610372721..e295f9b3b 100644
--- a/httemplate/view/cust_main/payment_history/voided_payment.html
+++ b/httemplate/view/cust_main/payment_history/voided_payment.html
@@ -1,33 +1,24 @@
-<DEL>Payment <% $info %></DEL>
-<I>voided <% time2str("%D", $cust_pay_void->void_date) %>
-by <% $cust_pay_void->otaker %></I><% $unvoid %>
+<DEL><% mt("Payment [_1] by [_2]", $info, $cust_pay_void->otaker ) |h %></DEL>
+<I>voided 
+% my $void_user = $cust_pay_void->void_access_user;
+% if ($void_user) {
+    by <% $void_user->username %>
+% }
+% my $reason = $cust_pay_void->reason;
+% if ($reason) {
+     (<% $reason |h %>)
+% }
+<% mt("on [_1]", time2str($date_format, $cust_pay_void->void_date) ) |h %> 
+</I>
+<% $unvoid %>
 <%init>
 
 my( $cust_pay_void, %opt ) = @_;
 
-my $curuser = $FS::CurrentUser::CurrentUser;
+my $date_format = $opt{'date_format'} || '%m/%d/%Y';
 
-my $payby = $cust_pay_void->payby;
-
-my $payinfo;
-if ( $payby eq 'CARD' ) {
-  $payinfo = $cust_pay_void->paymask;
-} elsif ( $payby eq 'CHEK' ) {
-  my( $account, $aba ) = split('@', $cust_pay_void->paymask );
-  $payinfo = "ABA $aba, Acct #$account";
-} else {
-  $payinfo = $cust_pay_void->payinfo;
-}
-
-$payby =~ s/^BILL$/Check #/ if $payinfo;
-$payby =~ s/^CHEK$/Electronic check /;
-$payby =~ s/^PREP$/Prepaid card /;
-$payby =~ s/^CARD$/Credit card #/; 
-$payby =~ s/^COMP$/Complimentary by /; 
-$payby =~ s/^CASH$/Cash/;
-$payby =~ s/^WEST$/Western Union/;
-$payby =~ s/^MCRD$/Manual credit card/;
-$payby =~ s/^BILL$//;
+my ($payby,$payinfo) = translate_payinfo($cust_pay_void);
+$payby = translate_payby($payby,$payinfo);
 my $info = $payby ? "($payby$payinfo)" : '';
 
 if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) {
@@ -36,19 +27,14 @@ if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) {
 }
 
 my $unvoid = '';
-if ( $cust_pay_void->closed !~ /^Y/i
-     && $curuser->access_right('Unvoid')
-   )
-{
-  $unvoid = qq! (<A HREF="javascript:areyousure('!.
-            qq!${p}misc/unvoid-cust_pay_void.cgi?!. $cust_pay_void->paynum.
-            qq!', 'Are you sure you want to unvoid this payment?')"!.
-            qq! TITLE="Unvoid this payment from the database!.
-              ( $cust_pay_void->payby =~ /^(CARD|CHEK)$/
-                ? ' (do not send anything to the payment gateway)'
-                : '' 
-              ). '"'.
-            qq!>unvoid</A>)!;
-}
+my $unvoidmsg = $cust_pay_void->payby =~ /^(CARD|CHEK)$/
+                ? ' ('.emt('do not send anything to the payment gateway') .')'
+                : '';
+$unvoid = areyousure_link("${p}misc/unvoid-cust_pay_void.cgi?".$cust_pay_void->paynum,
+                            emt('Are you sure you want to unvoid this payment?'),
+                            emt('Unvoid this payment from the database') . $unvoidmsg,
+                            emt('unvoid')
+                         )
+  if $cust_pay_void->closed !~ /^Y/i && $opt{'Unvoid payments'};
 
 </%init>