add some time-worked reporting
[freeside.git] / httemplate / elements / select-otaker.html
diff --git a/httemplate/elements/select-otaker.html b/httemplate/elements/select-otaker.html
new file mode 100644 (file)
index 0000000..2a689f3
--- /dev/null
@@ -0,0 +1,27 @@
+<SELECT NAME="otaker">
+
+% unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
+  <OPTION VALUE="">all</OPTION>
+% }
+
+% foreach my $otaker ( @{ $opt{'otakers'} } ) { 
+    <OPTION VALUE="<% $otaker %>"><% $otaker %></OPTION>
+% } 
+
+</SELECT>
+
+<%init>
+
+my %opt = @_;
+
+unless ( $opt{'otakers'} ) {
+
+  my $sth = dbh->prepare("SELECT username FROM access_user".
+                       " WHERE disabled = '' or disabled IS NULL")
+    or die dbh->errstr;
+  $sth->execute or die $sth->errstr;
+  $opt{'otakers'} = [ map { $_->[0] } @{$sth->fetchall_arrayref} ];
+
+}
+
+</%init>