we're not a disk drive manufacturer
[freeside.git] / FS / FS / UI / Web.pm
index 6a97f96..744d5f7 100644 (file)
@@ -138,6 +138,10 @@ sub svc_label_link {
 
 sub svc_X_link {
   my ($x, $m, $part_svc, $cust_svc) = @_ or return '';
+
+  return $x
+   unless $FS::CurrentUser::CurrentUser->access_right('View customer services');
+
   my $ahref = svc_url(
     'ahref'    => 1,
     'm'        => $m,
@@ -149,6 +153,15 @@ sub svc_X_link {
   "$ahref$x</A>";
 }
 
+#this probably needs an ACL too...
+sub svc_export_links {
+  my ($m, $part_svc, $cust_svc) = @_ or return '';
+
+  my $ahref = $cust_svc->export_links;
+
+  join('', @$ahref);
+}
+
 sub parse_lt_gt {
   my($cgi, $field) = @_;
 
@@ -201,6 +214,8 @@ sub cust_header {
   warn "FS::UI:Web::cust_header called"
     if $DEBUG;
 
+  my $conf = new FS::Conf;
+
   my %header2method = (
     'Customer'                 => 'name',
     'Cust. Status'             => 'ucfirst_cust_status',
@@ -226,6 +241,8 @@ sub cust_header {
     'Payment Type'             => 'payby',
     'Current Balance'          => 'current_balance',
   );
+  $header2method{'Cust#'} = 'display_custnum'
+    if $conf->exists('cust_main-default_agent_custid');
 
   my %header2colormethod = (
     'Cust. Status' => 'cust_statuscolor',
@@ -248,7 +265,6 @@ sub cust_header {
 
   } else {
 
-    my $conf = new FS::Conf;
     if (    $conf->exists('cust-fields')
          && $conf->config('cust-fields') =~ /^([\w\. \|\#\(\)]+):?/
        )
@@ -324,8 +340,8 @@ setting is supplied, the <B>cust-fields</B> configuration value.
 =cut
 
 sub cust_fields {
-  my $svc_x = shift;
-  warn "FS::UI::Web::cust_fields called for $svc_x ".
+  my $record = shift;
+  warn "FS::UI::Web::cust_fields called for $record ".
        "(cust_fields: @cust_fields)"
     if $DEBUG > 1;
 
@@ -334,12 +350,12 @@ sub cust_fields {
 
   my $seen_unlinked = 0;
   map { 
-    if ( $svc_x->custnum ) {
-      warn "  $svc_x -> $_"
+    if ( $record->custnum ) {
+      warn "  $record -> $_"
         if $DEBUG > 1;
-      $svc_x->$_(@_);
+      $record->$_(@_);
     } else {
-      warn "  ($svc_x unlinked)"
+      warn "  ($record unlinked)"
         if $DEBUG > 1;
       $seen_unlinked++ ? '' : '(unlinked)';
     }