RT# 81183 Fix crash processing payment with new payment method
[freeside.git] / httemplate / misc / custom_link_proxy.cgi
1 % if( $response->is_success ) {
2 <% $response->decoded_content %>
3 % }
4 % else {
5 <% $response->error_as_HTML %>
6 % }
7 <%init>
8
9 my( $custnum ) = $cgi->param('custnum');
10 my $cust_main = qsearchs('cust_main', { custnum => $custnum } ) 
11   or die "custnum '$custnum' not found"; # just check for existence
12
13 my $conf = new FS::Conf;
14 my $url = $conf->config('cust_main-custom_link');
15
16 my $agentnum = $cust_main->agentnum;
17 my $agent_custid = $cust_main->agent_custid;
18 my $curuser = $FS::CurrentUser::CurrentUser;
19 my $usernum = $curuser->usernum;
20 # like eval(qq("$url")) but with fewer things that can go wrong
21 # and if $custnum isn't mentioned, assume it goes at the end
22 $url =~ s/\$custnum/$custnum/ or $url .= $custnum;
23 $url =~ s/\$agentnum/$agentnum/;
24 $url =~ s/\$agent_custid/$agent_custid/;
25 $url =~ s/\$usernum/$usernum/;
26
27 #warn $url;
28
29 die "access denied"
30   unless $curuser->access_right('View customer');
31
32 my $ua = new LWP::UserAgent;
33 my $response = $ua->get($url);
34 </%init>