summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-08-03 03:30:20 +0000
committermark <mark>2010-08-03 03:30:20 +0000
commit720cf723d2c8e88760704e2fdc50ebf48e0574f2 (patch)
treecfd22ecedf5c9db463fe345c193d51e5a88052ac
parent746eb018918ec4660870c79d0ff907fe0920696a (diff)
customer view tab for an external info page, RT#8903
-rw-r--r--FS/FS/Conf.pm13
-rw-r--r--FS/FS/Mason.pm1
-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
5 files changed, 65 insertions, 0 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index ce8bd296e..fdb6e9a38 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3891,6 +3891,19 @@ and customer address. Include units.',
'type' => 'checkbox',
},
+ {
+ 'key' => 'cust_main-custom_link',
+ 'section' => 'UI',
+ 'description' => 'URL to use as source for the "Custom" tab in the View Customer page. The custnum will be appended.',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'cust_main-custom_title',
+ 'section' => 'UI',
+ 'description' => 'Title for the "Custom" tab in the View Customer page.',
+ 'type' => 'text',
+ },
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index 0f1415009..bcf727e3c 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -111,6 +111,7 @@ if ( -e $addl_handler_use_file ) {
#selectlayers.html
use Locale::Country;
use Business::US::USPS::WebTools::AddressStandardization;
+ use LWP::UserAgent;
use FS;
use FS::UID qw( getotaker dbh datasrc driver_name );
use FS::Record qw( qsearch qsearchs fields dbdef
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 f6bef43ba..0b6148da0 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -233,6 +233,10 @@ Comments
<% include('cust_main/change_history.html', $cust_main ) %>
% }
+% if ( $view eq 'custom' ) {
+<% include('cust_main/custom.html', $cust_main ) %>
+% }
+
</DIV>
<% include('/elements/footer.html') %>
<%init>
@@ -273,6 +277,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>