changes to support eWay third-party payment, #10208
[freeside.git] / httemplate / edit / part_svc.cgi
index 6fe015a..d156ccd 100755 (executable)
@@ -15,6 +15,8 @@ Disable new orders <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->
 Service definitions are the templates for items you offer to your customers.
 <UL><LI>svc_acct - Accounts - anything with a username (Mailboxes, PPP accounts, shell accounts, RADIUS entries for broadband, etc.)
     <LI>svc_domain - Domains
+    <LI>svc_cert - Certificates
+    <LI>svc_dsl - DSL
     <LI>svc_forward - Mail forwarding
     <LI>svc_mailinglist - Mailing list
     <LI>svc_www - Virtual domain website
@@ -100,12 +102,14 @@ that field.
 %
 %      my $columns = 3;
 %      my $count = 0;
+%      my $communigate = 0;
 %      my @part_export =
 %        map { qsearch( 'part_export', {exporttype => $_ } ) }
 %          keys %{FS::part_export::export_info($layer)};
 %      $html .= '<BR><BR>'. table(). 
 %               "<TR><TH COLSPAN=$columns>Exports</TH></TR><TR>";
 %      foreach my $part_export ( @part_export ) {
+%        $communigate++ if $part_export->exporttype =~ /^communigate/;
 %        $html .= '<TD><INPUT TYPE="checkbox"'.
 %                 ' NAME="exportnum'. $part_export->exportnum. '"  VALUE="1" ';
 %        $html .= 'CHECKED'
@@ -113,8 +117,12 @@ that field.
 %              && qsearchs( 'export_svc', {
 %                                   exportnum => $part_export->exportnum,
 %                                   svcpart   => $clone || $part_svc->svcpart });
-%        $html .= '>'. $part_export->exportnum. ': '. $part_export->exporttype.
-%                 ' to '. $part_export->machine. '</TD>';
+%        $html .= '>'.$part_export->exportnum. ': ';
+%        $html .= $part_export->exportname . '<DIV ALIGN="right"><FONT SIZE=-1>'
+%          if ( $part_export->exportname );
+%        $html .= $part_export->exporttype. ' to '. $part_export->machine;
+%        $html .= '</FONT></DIV>' if ( $part_export->exportname );
+%        $html .= '</TD>';
 %        $count++;
 %        $html .= '</TR><TR>' unless $count % $columns;
 %      }
@@ -132,16 +140,17 @@ that field.
 %      my $bgcolor;
 %
 %      #yucky kludge
-%      my @fields = defined( dbdef->table($layer) )
-%                      ? grep {
-%                               $_ ne 'svcnum' &&
-%                               ( !FS::part_svc->svc_table_fields($layer)
-%                                     ->{$_}->{disable_part_svc_column}   ||
-%                                 $part_svc->part_svc_column($_)->columnflag
-%                               )
-%                             }
-%                             fields($layer)
-%                      : ();
+%      my @fields = ();
+%      if ( defined( dbdef->table($layer) ) ) {
+%        @fields = grep {
+%            $_ ne 'svcnum'
+%            && ( $communigate || !$communigate_fields{$layer}->{$_} )
+%            && ( !FS::part_svc->svc_table_fields($layer)
+%                   ->{$_}->{disable_part_svc_column}
+%                 || $part_svc->part_svc_column($_)->columnflag
+%               )
+%        } fields($layer);
+%      }
 %      push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge
 %      $part_svc->svcpart($clone) if $clone; #haha, undone below
 %
@@ -291,12 +300,22 @@ that field.
 %                  (grep(/^$rvalue$/, split(',',$value)) ? ' SELECTED>' : '>' ).
 %                  $record->$select_label(). '</OPTION>';
 %            } #next $record
-%          } else { # select_list
+%          } elsif ( $def->{select_list} ) {
 %            foreach my $item ( @{$def->{select_list}} ) {
 %              $html .= qq!<OPTION VALUE="$item"!.
 %                    (grep(/^$item$/, split(',',$value)) ? ' SELECTED>' : '>' ).
 %                    $item. '</OPTION>';
 %            } #next $item
+%          } elsif ( $def->{select_hash} ) {
+%            if ( ref($def->{select_hash}) eq 'ARRAY' ) {
+%              tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} };
+%              $def->{select_hash} = \%hash;
+%            }
+%            foreach my $key ( keys %{$def->{select_hash}} ) {
+%              $html .= qq!<OPTION VALUE="$key"!.
+%                    (grep(/^$key$/, split(',',$value)) ? ' SELECTED>' : '>' ).
+%                    $def->{select_hash}{$key}. '</OPTION>';
+%            } #next $key
 %          } #endif
 %          $html .= '</SELECT>';
 %
@@ -410,7 +429,21 @@ my $action = $part_svc->svcpart ? 'Edit' : 'Add';
 my $hashref = $part_svc->hashref;
 #   my $p_svcdb = $part_svc->svcdb || 'svc_acct';
 
-
+my %communigate_fields = (
+  'svc_acct'        => { map { $_=>1 }
+                           qw( file_quota file_maxnum file_maxsize
+                               password_selfchange password_recover
+                             ),
+                           grep /^cgp_/, fields('svc_acct')
+                       },
+  'svc_domain'      => { map { $_=>1 }
+                           qw( max_accounts trailer parent_svcnum ),
+                           grep /^(cgp|acct_def)_/, fields('svc_domain')
+                       },
+  #'svc_forward'     => { map { $_=>1 } qw( ) },
+  #'svc_mailinglist' => { map { $_=>1 } qw( ) },
+  #'svc_cert'        => { map { $_=>1 } qw( ) },
+);
 
 </%init>