79788210377555ae643855c3581d6a726fa87b9c
[freeside.git] / httemplate / view / cust_main / payment_history / refund.html
1 <% $pre %>Refund<% $post %>
2 (<% $payby. $payinfo %>)
3 by <% $cust_refund->otaker %><% $view %><% $delete %>
4 <%init>
5
6 my( $cust_refund, %opt ) = @_;
7
8 my $conf = new FS::Conf;
9 my $curuser = $FS::CurrentUser::CurrentUser;
10
11 my $payby = $cust_refund->payby;
12 my $payinfo = $payby eq 'CARD'
13                 ? $cust_refund->paymask
14                 : $cust_refund->payinfo;
15
16 $payby =~ s/^BILL$/Check #/ if $payinfo;
17 $payby =~ s/^BILL$/Check/;
18 $payby =~ s/^CHEK$/Electronic check /;
19 $payby =~ s/^(CARD|COMP)$/$1 /;
20
21 my($pre, $post) = ('', '');
22 if ( $cust_refund->unapplied > 0 ) {
23   $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
24   $post = '</FONT></B>';
25 }
26
27 my $view =
28   ' ('. include('/elements/popup_link.html',
29                   'label'     => 'view receipt',
30                   'action'    => "${p}view/cust_refund.html?link=popup;".
31                                  'refundnum='. $cust_refund->refundnum,
32                   'actionlabel' => 'Payment Receipt',
33                ).
34    ')';
35
36
37 my $delete = '';
38 if ( $cust_refund->closed !~ /^Y/i
39      && $conf->exists('deleterefunds')
40      && $curuser->access_right('Delete refund')
41    )
42 {
43   $delete = qq! (<A HREF="javascript:areyousure('!.
44             qq!${p}misc/delete-cust_refund.cgi?!. $cust_refund->refundnum.
45             qq!', 'Are you sure you want to delete this refund?')"!.
46             qq! TITLE="Delete this refund from the database completely - not recommended"!.
47             qq!>delete</A>)!;
48 }
49
50 </%init>
51