This commit was generated by cvs2svn to compensate for changes in r10640,
[freeside.git] / httemplate / elements / select-torrus_serviceid.html
1 <SELECT NAME="<% $opt{'field'} || 'serviceid' %>">
2
3 % unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
4   <OPTION VALUE="">Select serviceid</OPTION>
5 % }
6
7 % foreach my $serviceid ( keys %serviceid ) {
8     <OPTION VALUE="<%$serviceid%>"
9             <% $serviceid eq $value ? 'SELECTED' : '' %>
10     ><% $serviceid %></OPTION>
11 % } 
12
13 </SELECT>
14
15 <%init>
16
17 my %opt = @_;
18
19 my $value = $opt{'curr_value'} || $opt{'value'};
20
21 #is this going to get too slow or will the index make it okay?
22 my $sth = dbh->prepare("SELECT DISTINCT(serviceid) FROM srvexport")
23   or die dbh->errstr;
24 $sth->execute or die $sth->errstr;
25 my %serviceid = ();
26 while ( my $row = $sth->fetchrow_arrayref ) {
27   my $serviceid = $row->[0];
28   $serviceid =~ s/_(IN|OUT)$//;
29   $serviceid{$serviceid}=1;
30 }
31
32 </%init>