projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add regular header/footer to svc_www view and edit
[freeside.git]
/
httemplate
/
elements
/
select-table.html
diff --git
a/httemplate/elements/select-table.html
b/httemplate/elements/select-table.html
index
0c3c005
..
3235ef6
100644
(file)
--- a/
httemplate/elements/select-table.html
+++ b/
httemplate/elements/select-table.html
@@
-9,8
+9,11
@@
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() } @records ) {
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() } @records ) {
+% my $matches = 0;
+% ref($opt{'value'}) ? (exists($opt{'value'}->{$record->$key()}) and $matches=1)
+% : ($opt{'value'} == $record->$key() and $matches=1);
- <OPTION VALUE="<% $record->$key() %>"<% $
opt{'value'} == $record->$key()
? ' SELECTED' : '' %>><% $record->$name_col() %>
+ <OPTION VALUE="<% $record->$key() %>"<% $
matches
? ' SELECTED' : '' %>><% $record->$name_col() %>
% }
% }
@@
-59,6
+62,7
@@
if ( $opt{records} ) {
}
unless ( ! $opt{value}
}
unless ( ! $opt{value}
+ or ref($opt{value})
or ! exists( $opt{hashref}->{disabled} ) #??
or grep { $opt{value} == $_->$key() } @records
) {
or ! exists( $opt{hashref}->{disabled} ) #??
or grep { $opt{value} == $_->$key() } @records
) {
@@
-72,6
+76,10
@@
unless ( ! $opt{value}
push @records, $record if $record;
}
push @records, $record if $record;
}
+if ( ref( $opt{value} ) eq 'ARRAY' ) {
+ $opt{value} = { map { $_ => 1 } @{$opt{value}} };
+}
+
my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
</%init>
my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
</%init>