X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-table.html;h=741e51e494e3a8630ac1e59e39c3667c080a33d8;hb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;hp=32a61e9899c3689a30482bc0d455267b77ac3d22;hpb=6c4d9632f4d5cd1164ab9183932fbdf9137945aa;p=freeside.git diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html index 32a61e989..741e51e49 100644 --- a/httemplate/elements/select-table.html +++ b/httemplate/elements/select-table.html @@ -24,15 +24,21 @@ Example: 'extra_sql' => '', 'agent_virt' => 0, #set true and make sure the result is JOINed to #something with agentnum (usually cust_main) + 'agent_null' => 0, #set true to always show un-agented entries 'agent_null_right' => '', #right to see un-agented entries #or 'records' => \@records, #instead of search params + #instead of the primary key... only for special cases + 'value_col' => 'columnname', + #basic params controlling the resulting @@ -43,6 +49,10 @@ Example: # %} @@ -93,6 +127,8 @@ my( %opt ) = @_; warn "elements/select-table.html: \n". Dumper(%opt) if exists $opt{debug} && $opt{debug}; +$opt{'extra_option_attributes'} ||= []; + my $onchange = ''; if ( $opt{'onchange'} ) { $onchange = $opt{'onchange'}; @@ -105,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'}; @@ -120,7 +156,8 @@ if ( $opt{'agent_virt'} ) { $extra_sql .= ( $extra_sql =~ /WHERE/i || scalar(keys %$hashref ) ? ' AND ' : ' WHERE ' ). $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => $opt{'agent_null_right'} + 'null' => $opt{'agent_null'}, + 'null_right' => $opt{'agent_null_right'}, ); } @@ -137,7 +174,7 @@ if ( $opt{'records'} ) { }); } -unless ( ! $value +unless ( $value < 1 # !$value #ignore negatives too or ref($value) or ! exists( $opt{hashref}->{disabled} ) #?? or grep { $value == $_->$key() } @records @@ -157,6 +194,7 @@ if ( ref( $value ) eq 'ARRAY' ) { $value = { map { $_ => 1 } @$value }; } -my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : (); +my @post_options = $opt{post_options} ? @{ $opt{post_options} } : ();