diff options
-rw-r--r-- | httemplate/edit/elements/edit.html | 2 | ||||
-rw-r--r-- | httemplate/edit/elements/svc_Common.html | 10 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 10 | ||||
-rw-r--r-- | httemplate/elements/select-table.html | 5 |
4 files changed, 21 insertions, 6 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 3e8b6b8ed..9e5c4e03c 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -284,7 +284,7 @@ Example: % % #select-table, checkboxes-table % $include_common{$_} = $f->{$_} -% foreach grep exists($f->{$_}), qw( table name_col ); +% foreach grep exists($f->{$_}), qw( table name_col value_col ); % % #checkboxes-table % $include_common{$_} = $f->{$_} diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html index 6173ba7f1..0ffb4319f 100644 --- a/httemplate/edit/elements/svc_Common.html +++ b/httemplate/edit/elements/svc_Common.html @@ -64,6 +64,16 @@ $f->{'value'} = $columndef->columnvalue; } elsif ( $flag eq 'A' ) { $f->{'type'} = 'hidden'; + } elsif ( $flag eq 'M' ) { + $f->{'type'} = 'select-table'; + $f->{'table'} = 'inventory_item'; + $f->{'name_col'} = 'item'; + $f->{'value_col'} = 'item'; + $f->{'hashref'} = { + 'classnum' => $columndef->columnvalue, + 'svcnum' => '', + }; + $f->{'empty_label'} = 'Select inventory item'; } if ( $f->{'type'} eq 'select-svc_pbx' ) { diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 80f61a100..51925c0c5 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -65,10 +65,9 @@ that field. % 'condition' => % sub { !ref($_[0]) || $_[0]->{disable_select} }, % }, -%# need to template-ize httemplate/edit/svc_* first -%# 'M' => { 'desc' => 'Manual selection from inventory', -%# 'condition' => $inv_sub, -%# }, +% 'M' => { 'desc' => 'Manual selection from inventory', +% 'condition' => $inv_sub, +% }, % 'A' => { 'desc' => 'Automatically fill in from inventory', % 'condition' => $inv_sub, % }, @@ -185,6 +184,9 @@ that field. % % foreach my $f ( keys %flag ) { % +% # need to template-ize more httemplate/edit/svc_* first +% next if $f eq 'M' and $layer !~ /^svc_(broadband|external|phone)$/; +% % #here is where the SUB from above is called, to skip some choices % next if $flag{$f}->{condition} % && &{ $flag{$f}->{condition} }( $def, $layer, $field ); diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 3e25c9f49..772f0c653 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -29,6 +29,9 @@ Example: #or 'records' => \@records, #instead of search params + #instead of the primary key... only for special cases + 'value_col' => 'columnname', + #basic params controlling the resulting <SELECT> 'pre_options' => [ 'value' => 'option' ], #before normal options 'post_options' => [ 'value' => 'option' ], #after normal options @@ -138,7 +141,7 @@ if ( $opt{'onchange'} ) { my $dbdef_table = dbdef->table($opt{'table'}) or die "can't find dbdef for ". $opt{'table'}. " table\n"; -my $key = $dbdef_table->primary_key; #? $opt{'primary_key'} || +my $key = $opt{'value_col'} || $dbdef_table->primary_key; my $name_col = $opt{'name_col'}; |