-<% $pre %>Refund<% $post %>
-(<% $payby. $payinfo %>)
-by <% $cust_refund->otaker %><% $view %><% $delete %>
+<% $refund %>
+(<% "$payby$payinfo" %>)
+<% "$view$email$delete" %>
<%init>
my( $cust_refund, %opt ) = @_;
-my $curuser = $FS::CurrentUser::CurrentUser;
-
my $payby = $cust_refund->payby;
my $payinfo = $payby eq 'CARD'
? $cust_refund->paymask
: $cust_refund->payinfo;
+$payby = translate_payby_refund($payby,$payinfo);
-$payby =~ s/^BILL$/Check #/ if $payinfo;
-$payby =~ s/^BILL$/Check/;
-$payby =~ s/^CHEK$/Electronic check /;
-$payby =~ s/^(CARD|COMP)$/$1 /;
-
-my($pre, $post) = ('', '');
-if ( $cust_refund->unapplied > 0 ) {
- $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
- $post = '</FONT></B>';
-}
+my $refund = emt("Refund by [_1]",$cust_refund->otaker);
+$refund = '<B><FONT COLOR="#FF0000">'
+ . emt("Unapplied Refund by [_1]",$cust_refund->otaker)
+ . '</FONT></B>'
+ if $cust_refund->unapplied > 0;
my $view =
' ('. include('/elements/popup_link.html',
- 'label' => 'view receipt',
+ 'label' => emt('view receipt'),
'action' => "${p}view/cust_refund.html?link=popup;".
'refundnum='. $cust_refund->refundnum,
- 'actionlabel' => 'Payment Receipt',
+ 'actionlabel' => emt('Payment Receipt'),
).
')';
+my $email = $opt{'has_email_address'} ?
+ q! (<A HREF="javascript:void(0)" ONCLICK="areyousure_popup('Send email receipt for refund to customer?','!.
+ "${p}view/cust_refund.html?link=email;refundnum=".
+ $cust_refund->refundnum.
+ q!','Email Refund Receipt')" TITLE="Send email receipt">email receipt</A>)!
+ : '';
my $delete = '';
-if ( $cust_refund->closed !~ /^Y/i
- && $opt{'deleterefunds'}
- && $curuser->access_right('Delete refund')
- )
-{
- $delete = qq! (<A HREF="javascript:areyousure('!.
- qq!${p}misc/delete-cust_refund.cgi?!. $cust_refund->refundnum.
- qq!', 'Are you sure you want to delete this refund?')"!.
- qq! TITLE="Delete this refund from the database completely - not recommended"!.
- qq!>delete</A>)!;
-}
+$delete = areyousure_link("${p}misc/delete-cust_refund.cgi?".$cust_refund->refundnum,
+ emt('Are you sure you want to delete this refund?'),
+ emt('Delete this refund from the database completely - not recommended'),
+ emt('delete')
+ )
+ if $cust_refund->closed !~ /^Y/i
+ && $opt{'deleterefunds'}
+ && $opt{'Delete refund'};
</%init>