customer view tab for an external info page, RT#8903
authormark <mark>
Tue, 3 Aug 2010 03:30:34 +0000 (03:30 +0000)
committermark <mark>
Tue, 3 Aug 2010 03:30:34 +0000 (03:30 +0000)
FS/FS/Conf.pm
FS/FS/Mason.pm
httemplate/misc/custom_link_proxy.cgi [new file with mode: 0644]
httemplate/view/cust_main.cgi
httemplate/view/cust_main/custom.html [new file with mode: 0644]

index fe5d3ed..068ed97 100644 (file)
@@ -3450,7 +3450,6 @@ and customer address. Include units.',
     'per_agent'   => 1,
   },
 
     'per_agent'   => 1,
   },
 
-
   {
     'key'         => 'selfservice-menu_top_image',
     'section'     => 'self-service',
   {
     'key'         => 'selfservice-menu_top_image',
     'section'     => 'self-service',
@@ -3792,6 +3791,20 @@ and customer address. Include units.',
     'select_enum' => [ 'misc_info', 'top' ],
   },
 
     'select_enum' => [ 'misc_info', 'top' ],
   },
 
+  {
+    '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" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
index 8efab49..8a617cc 100644 (file)
@@ -107,6 +107,7 @@ if ( -e $addl_handler_use_file ) {
                                         #selectlayers.html
   use Locale::Country;
   use Business::US::USPS::WebTools::AddressStandardization;
                                         #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
   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 (file)
index 0000000..e5934e4
--- /dev/null
@@ -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>
index 0b267ad..d5b7d93 100755 (executable)
@@ -230,6 +230,10 @@ Comments
 <% include('cust_main/change_history.html', $cust_main ) %>     
 % }
 
 <% include('cust_main/change_history.html', $cust_main ) %>     
 % }
 
+% if ( $view eq 'custom' ) {
+<% include('cust_main/custom.html', $cust_main ) %>
+% }
+
 <% include('/elements/footer.html') %>
 <%init>
 
 <% 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');
                                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;
 $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 (file)
index 0000000..8e2e07b
--- /dev/null
@@ -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>