combine ticket notification scrips, #15353
[freeside.git] / httemplate / elements / select-user.html
1 <SELECT NAME="usernum">
2
3 % unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
4   <OPTION VALUE="">all</OPTION>
5 % }
6
7 % foreach my $usernum (
8 %   sort { $opt{'access_user'}->{$a} cmp $opt{'access_user'}->{$b} }
9 %   keys %{ $opt{'access_user'} }
10 % ) { 
11     <OPTION VALUE="<%$usernum%>"><% $opt{'access_user'}->{$usernum} %></OPTION>
12 % } 
13
14 </SELECT>
15
16 <%init>
17
18 my %opt = @_;
19
20 unless ( $opt{'access_user'} ) {
21
22   my $sth = dbh->prepare("
23     SELECT usernum, username FROM access_user
24       WHERE disabled = '' or disabled IS NULL
25   ") or die dbh->errstr;
26   $sth->execute or die $sth->errstr;
27   while ( my $row = $sth->fetchrow_arrayref ) {
28     $opt{'access_user'}->{$row->[0]} = $row->[1];
29   }
30
31 }
32
33 </%init>