add selfservice_access selection to part_svc, RT#15628
[freeside.git] / httemplate / edit / part_svc.cgi
index 8ca0196..c03de5c 100755 (executable)
@@ -9,8 +9,26 @@
       Service Part #<% $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %>
 <BR><BR>
 Service  <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR>
+
+Self-service access:
+<SELECT NAME="selfservice_access">
+% tie my %selfservice_access, 'Tie::IxHash', #false laziness w/browse/part_svc
+%   ''         => 'Yes',
+%   'hidden'   => 'Hidden',
+%   'readonly' => 'Read-only',
+% ;
+% for (keys %selfservice_access) {
+  <OPTION VALUE="<% $_ %>"
+          <% $_ eq $hashref->{'selfservice_access'} ? 'SELECTED' : '' %>
+  ><% $selfservice_access{$_} %>
+% }
+</SELECT><BR>
+
 <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>>&nbsp;Disable new orders<BR>
+
 <INPUT TYPE="checkbox" NAME="preserve" VALUE="Y"<% $hashref->{'preserve'} eq 'Y' ? ' CHECKED' : '' %>>&nbsp;Preserve this service on package cancellation<BR>
+
+
 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $hashref->{svcpart} %>">
 
 <BR>
@@ -80,6 +98,7 @@ Service  <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR>
 %    #'form_action'    => 'process/part_svc.cgi',
 %    'form_action'    => 'part_svc.cgi', #self
 %    'form_text'      => [ qw( svc svcpart ) ],
+%    'form_select'    => [ 'selfservice_access' ],
 %    'form_checkbox'  => [ 'disabled', 'preserve' ],
 %    'layer_callback' => sub {
 %      my $layer = shift;
@@ -139,7 +158,11 @@ Service  <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR>
 %               )
 %        } fields($layer);
 %      }
-%      push @fields, 'usergroup' if $layer eq 'svc_acct'; #kludge
+%      push @fields, 'usergroup' 
+%        if $layer eq 'svc_acct'
+%          or ( $layer eq 'svc_broadband' and 
+%               $conf->exists('svc_broadband-radius') ); # double kludge
+%               # (but we do want to check the config, right?)
 %      $part_svc->svcpart($clone) if $clone; #haha, undone below
 %
 %
@@ -320,7 +343,9 @@ Service  <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR>
 %                             'curr_value'   => $value,
 %                             'element_name' => "${layer}__${field}",
 %                             'element_etc'  => $disabled,
-%                             'multiple'     => ($flag eq 'S'),
+%                             'multiple'     => ($def->{multiple} ||
+%                                                $flag eq 'S'),
+%                                 # allow the table def to force 'multiple'
 %                          );
 %
 %        } elsif ( $def->{type} eq 'communigate_pro-accessmodes' ) {
@@ -370,7 +395,8 @@ Service  <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR>
 %
 %      $html .= include('/elements/progress-init.html',
 %                         $layer, #form name
-%                         [ qw(svc svcpart disabled preserve exportnum),
+%                         [ qw(svc svcpart selfservice_access disabled preserve
+%                              exportnum),
 %                           @fields ],
 %                         'process/part_svc.cgi',
 %                         $p.'browse/part_svc.cgi',
@@ -400,6 +426,7 @@ Table <% $widget->html %>
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
+my $conf = FS::Conf->new;
 my $part_svc;
 my $clone = '';
 if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {#clone