1 % if ( scalar(@{ $opt{'cdrbatches'} }) ) {
3 <SELECT NAME="<% $opt{'name'} || 'cdrbatch' %>">
5 <OPTION VALUE="__ALL__">All
6 <OPTION VALUE="">(blank)
8 % foreach my $cdrbatch ( @{ $opt{'cdrbatches'} } ) {
9 <OPTION VALUE="<% $cdrbatch %>"<% $cdrbatch eq $selected_cdrbatch ? ' SELECTED' : '' %>><% $cdrbatch %>
16 <INPUT TYPE="hidden" NAME="cdrbatch" VALUE="__ALL__">
23 my $selected_cdrbatch = $opt{'curr_value'}; # || $opt{'value'} necessary?
25 my $conf = new FS::Conf;
27 unless ( $opt{'cdrbatches'} ) {
29 my $sth = dbh->prepare('SELECT DISTINCT cdrbatch FROM cdr')
31 $sth->execute or die $sth->errstr;
32 my %cdrbatches = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
33 @{ $opt{'cdrbatches'} } = grep $_, keys %cdrbatches;