service label localization, internals and UI, #71347
[freeside.git] / httemplate / edit / elements / part_svc_column.html
index 53cda85..93d3b3d 100644 (file)
@@ -77,6 +77,7 @@ that field.
     <TH BGCOLOR="#cccccc">Field</TH>
     <TH BGCOLOR="#cccccc">Label</TH>
     <TH BGCOLOR="#cccccc" COLSPAN=2>Modifier</TH>
+    <TH BGCOLOR="#cccccc"><% $manual_require ? 'Required?' : '' %></TH>
   </TR>
 % $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now
 % my $i = 0;
@@ -132,7 +133,10 @@ that field.
 %   } elsif ( $def->{'type'} eq 'select' ) {
 %
 %     if ( $def->{'select_table'} ) {
-      <& /elements/select-table.html,
+%       # set the 'select_svc' flag to enable two-step selection of services
+%       my $comp = '/elements/select-table.html';
+%       $comp = '/elements/select-svc.html' if $def->{'select_svc'};
+      <& $comp,
           'field'       => $name,
           'id'          => $name.'_select',
           'table'       => $def->{'select_table'},
@@ -140,7 +144,8 @@ that field.
           'value_col'   => $def->{'select_key'},
           'order_by'    => dbdef->table($def->{'select_table'})->primary_key,
           'multiple'    => $def->{'multiple'},
-          'disable_empty' => 1,
+          'disable_empty' => $def->{'select_allow_empty'} ? undef : 1,
+          'empty_label' => $def->{'select_allow_empty'} ? ' ' : undef,
           'curr_value'  => $value,
           # these can be switched between multiple and singular,
           # so put the complete curr_value in an attribute
@@ -209,9 +214,19 @@ that field.
       &>
 %   }
     </TD>
+    <TD>
+%   if ($manual_require && 
+%       (!$def->{'type'} || !(grep {$_ eq $def->{'type'}} ('checkbox','disabled')))
+%   ) {
+      <INPUT ID="<% $name.'_required' %>" TYPE="checkbox" NAME="<% $svcdb %>__<% $field %>_required" VALUE="Y" 
+        <% ($part_svc_column->required || $def->{'required'}) ? 'CHECKED' : '' %> 
+        <% $def->{'required'} ? 'DISABLED' : '' %>
+       >
+%   }
+    </TD>
   </TR>
   <TR CLASS="row<%$i%>">
-    <TD COLSPAN=2 CLASS="def_info">
+    <TD COLSPAN=3 CLASS="def_info">
 %   if ( $def->{def_info} ) {
       (<% $def->{def_info} %>)
     </TD>
@@ -227,7 +242,7 @@ that field.
     <TD COLSPAN=3 ALIGN="right">
       <% emt('Require "Provision" access right to edit password') %>
     </TD>
-    <TD>
+    <TD COLSPAN=2>
       <INPUT TYPE="checkbox" NAME="restrict_edit_password" VALUE="Y" \
       <% $part_svc->restrict_edit_password ? 'CHECKED' : '' %>>
     </TD>
@@ -243,7 +258,7 @@ that field.
     <TD COLSPAN=3 ALIGN="right">
       <% emt('This service has an attached router') %>
     </TD>
-    <TD>
+    <TD COLSPAN=2>
       <INPUT TYPE="checkbox" NAME="has_router" VALUE="Y" \
       <% $part_svc->has_router ? 'CHECKED' : '' %>>
     </TD>
@@ -253,8 +268,9 @@ that field.
 <& /elements/progress-init.html,
   $svcdb, #form name
   [ # form fields to send
-    qw(svc svcpart classnum selfservice_access disabled preserve exportnum),
-    @fields
+    'ALL'
+#    qw(svc svcpart classnum selfservice_access disabled preserve exportnum),
+#    @fields
   ],
   'process/part_svc.cgi',   # target
   $p.'browse/part_svc.cgi', # redirect landing
@@ -300,4 +316,5 @@ if ( $svcdb eq 'svc_acct'
 }
 
 my @defs = map { FS::part_svc->svc_table_fields($svcdb)->{$_} } @fields;
+my $manual_require = FS::part_svc->svc_table_info($svcdb)->{'manual_require'};
 </%init>