summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authormark <mark>2010-08-03 03:30:34 +0000
committermark <mark>2010-08-03 03:30:34 +0000
commit124601883f5c26ddc16d0f9d0890614dfd58a91e (patch)
tree6099d3232eceea17ab97cbbc6da2c0a64b398770 /httemplate
parent5f38c4055b82da17afabf6f65b0afc951de641fa (diff)
customer view tab for an external info page, RT#8903
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/misc/custom_link_proxy.cgi24
-rwxr-xr-xhttemplate/view/cust_main.cgi6
-rw-r--r--httemplate/view/cust_main/custom.html21
3 files changed, 51 insertions, 0 deletions
diff --git a/httemplate/misc/custom_link_proxy.cgi b/httemplate/misc/custom_link_proxy.cgi
new file mode 100644
index 000000000..e5934e4a6
--- /dev/null
+++ b/httemplate/misc/custom_link_proxy.cgi
@@ -0,0 +1,24 @@
+% if( $response->is_success ) {
+<% $response->decoded_content %>
+% }
+% else {
+<% $response->error_as_HTML %>
+% }
+<%init>
+
+my( $custnum ) = $cgi->param('custnum');
+my $cust_main = qsearchs('cust_main', { custnum => $custnum } )
+ or die "custnum '$custnum' not found"; # just check for existence
+
+my $conf = new FS::Conf;
+my $url = $conf->config('cust_main-custom_link') . $cust_main->custnum;
+#warn $url;
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right('View customer');
+
+my $ua = new LWP::UserAgent;
+my $response = $ua->get($url);
+</%init>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 0b267ad2e..d5b7d9341 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -230,6 +230,10 @@ Comments
<% include('cust_main/change_history.html', $cust_main ) %>
% }
+% if ( $view eq 'custom' ) {
+<% include('cust_main/custom.html', $cust_main ) %>
+% }
+
<% include('/elements/footer.html') %>
<%init>
@@ -269,6 +273,8 @@ $views{'Payment History'} = 'payment_history'
unless $conf->config('payby-default' eq 'HIDE');
$views{'Change History'} = 'change_history'
if $curuser->access_right('View customer history');
+$views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom'
+ if $conf->config('cust_main-custom_link');
$views{'Jumbo'} = 'jumbo';
my %viewname = reverse %views;
diff --git a/httemplate/view/cust_main/custom.html b/httemplate/view/cust_main/custom.html
new file mode 100644
index 000000000..8e2e07b75
--- /dev/null
+++ b/httemplate/view/cust_main/custom.html
@@ -0,0 +1,21 @@
+<IFRAME id="customframe"
+ src="<% $proxyurl %>"
+ onload="resizeFrame(this)"
+ frameborder=0
+ marginheight="0px"
+ marginwidth="0px"
+ width="100%"
+ scrolling="no"
+>
+</IFRAME>
+<SCRIPT TYPE="text/javascript">
+function resizeFrame(f) {
+ f.style.height = f.contentDocument.body.scrollHeight + 'px';
+}
+</SCRIPT>
+<%init>
+
+my( $cust_main ) = @_;
+
+my $proxyurl = $p.'/misc/custom_link_proxy.cgi?custnum='.$cust_main->custnum;
+</%init>