torrus, RT#10574
[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%>"><% $serviceid %></OPTION>
9 % } 
10
11 </SELECT>
12
13 <%init>
14
15 my %opt = @_;
16
17 #is this going to get too slow or will the index make it okay?
18 my $sth = dbh->prepare("SELECT DISTINCT(serviceid) FROM srvexport")
19   or die dbh->errstr;
20 $sth->execute or die $sth->errstr;
21 my %serviceid = ();
22 while ( my $row = $sth->fetchrow_arrayref ) {
23   my $serviceid = $row->[0];
24   $serviceid =~ s/_(IN|OUT)$//;
25   $serviceid{$serviceid}=1;
26 }
27
28 </%init>