[freeside-commits] freeside/httemplate/elements select-table.html, 1.6, 1.7

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Feb 7 17:46:47 PST 2007


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv23288/httemplate/elements

Modified Files:
	select-table.html 
Log Message:
agent type on package add/edit (ticket 1446)

Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- select-table.html	20 Dec 2006 09:49:08 -0000	1.6
+++ select-table.html	8 Feb 2007 01:46:44 -0000	1.7
@@ -9,8 +9,11 @@
   <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 @@
 }
 
 unless (    ! $opt{value}
+         or ref($opt{value})
          or ! exists( $opt{hashref}->{disabled} ) #??
          or grep { $opt{value} == $_->$key() } @records
        ) {
@@ -72,6 +76,10 @@
   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>



More information about the freeside-commits mailing list