resolve minor ACL glitch linking to payments
[freeside.git] / httemplate / view / cust_pay.html
1 % if ( $link eq 'popup' ) { 
2
3   <% include('/elements/header-popup.html', "Payment Receipt" ) %>
4
5   <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR>
6
7 % } elsif ( $link eq 'print' ) { 
8
9   <% include('/elements/header-popup.html', "Payment Receipt" ) %>
10   
11 % #it would be nice if the menubar could be hidden for print, but better to
12 % # have it available than not, otherwise the user winds up at a dead end
13   <% menubar(
14        "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
15      )
16   %>
17   <BR><BR>
18
19 % } else { 
20
21   <% include('/elements/header.html', "Payment Receipt", menubar(
22        "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
23        'Print receipt' => $pr_link,
24      ))
25   %>
26
27 % }
28
29 % unless ($link eq 'popup' ) {
30   <% include('/elements/small_custview.html',
31                $custnum,
32                scalar($conf->config('countrydefault')),
33                1, #no balance
34             )
35   %>
36   <BR><BR>
37 % } 
38
39 <% ntable("#cccccc", 2) %>
40
41 <TR>
42   <TD ALIGN="right">Payment#</TD>
43   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
44 </TR>
45
46 <TR>
47   <TD ALIGN="right">Date</TD>
48   <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay->_date %></B></TD>
49 </TR>
50
51 <TR>
52   <TD ALIGN="right">Amount</TD>
53   <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
54 </TR>
55
56 <TR>
57   <TD ALIGN="right">Payment method</TD>
58   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
59 </TR>
60
61 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) { 
62
63     <TR>
64       <TD ALIGN="right">Processor</TD>
65       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
66     </TR>
67
68     <TR>
69       <TD ALIGN="right">Authorization#</TD>
70       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->authorization %></B></TD>
71     </TR>
72
73 %   if ( $cust_pay->order_number ) {
74       <TR>
75         <TD ALIGN="right">Order#</TD>
76         <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
77       </TR>
78 %   }
79
80 % }
81
82 </TABLE>
83
84 % if ( $link eq 'print' ) {
85
86   <SCRIPT TYPE="text/javascript">
87     window.print();
88   </SCRIPT>
89
90 % }
91
92 % if ( $link =~ /^(popup|print)$/ ) { 
93     </BODY>
94   </HTML>
95 % } else {
96   <% include('/elements/footer.html') %>
97 % }
98
99 <%init>
100
101 my $curuser = $FS::CurrentUser::CurrentUser;
102
103 die "access denied"
104   unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
105   || $curuser->access_right('View customer payments');
106
107 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
108 my $paynum = $1;
109
110 my $link = '';
111 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
112   $link = $1;
113 }
114
115 my $cust_pay = qsearchs({
116   'select'    => 'cust_pay.*',
117   'table'     => 'cust_pay',
118   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
119   'hashref'   => { 'paynum' => $paynum },
120   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
121 });
122 die "Payment #$paynum not found!" unless $cust_pay;
123
124 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum";
125
126 my $custnum = $cust_pay->custnum;
127
128 my $conf = new FS::Conf;
129
130 my $money_char = $conf->config('money_char') || '$';
131
132 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
133
134 </%init>