enable manual selection from inventory dropdowns for svc_broadband, svc_external...
authorivan <ivan>
Mon, 1 Mar 2010 19:29:20 +0000 (19:29 +0000)
committerivan <ivan>
Mon, 1 Mar 2010 19:29:20 +0000 (19:29 +0000)
httemplate/edit/elements/edit.html
httemplate/edit/elements/svc_Common.html
httemplate/edit/part_svc.cgi
httemplate/elements/select-table.html

index 711c8d7..5f41ba0 100644 (file)
@@ -280,7 +280,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->{$_}
index 6173ba7..0ffb431 100644 (file)
                      $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' ) {
index 80f61a1..51925c0 100755 (executable)
@@ -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 );
index 10a8b27..1632b59 100644 (file)
@@ -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
     'empty_label'    => '', #better specify it though, the default might change
@@ -118,7 +121,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'};