+%# include export selection
+<& export_svc.html,
+ part_svc => $part_svc,
+ svcdb => $svcdb
+&>
For the selected table, you can give fields default or fixed (unchangeable)
values, or select an inventory class to manually or automatically fill in
that field.
@@ -92,6 +77,7 @@ that field.
Field
Label
Modifier
+
<% $manual_require ? 'Required?' : '' %>
% $part_svc->set('svcpart' => $opt{'clone'}) if $opt{'clone'}; # for now
% my $i = 0;
@@ -147,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'},
@@ -155,8 +144,12 @@ 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
+ 'element_etc' => 'default="'.encode_entities($value).'"',
&>
% } else {
% my (@options, %labels);
@@ -180,8 +173,8 @@ that field.
'curr_value' => $value,
&>
% }
-% } elsif ( $def->{'type'} =~ /select-(.*?).html/ ) {
- <& '/elements/'.$def->{'type'},
+% } elsif ( $def->{'type'} =~ /^select-(.*?)(.html)?$/ && $1 ne 'hardware' ) {
+ <& "/elements/select-$1.html",
'field' => $name,
'id' => $name.'_select',
'multiple' => $def->{'multiple'},
@@ -204,21 +197,36 @@ that field.
NAME="<%$name%>"
ID="<%$name%>"
VALUE="<%$value%>">
-% # inventory class selection
+% my $mode = 'inventory';
+% my $multiple = 1;
+% if ( $def->{'type'} eq 'select-hardware' ) {
+% $mode = 'hardware';
+% $multiple = 0;
+% }
<& /elements/select-table.html,
'field' => $name.'_classnum',
'id' => $name.'_select',
- 'table' => 'inventory_class',
+ 'table' => $mode.'_class',
'name_col' => 'classname',
'curr_value' => $value,
- 'empty_label' => 'Select inventory class',
- 'multiple' => 1,
+ 'empty_label' => "Select $mode class",
+ 'multiple' => $multiple,
&>
+% }
+
+