% if ( scalar(@{ $opt{'cdrbatches'} }) ) {
% } else {
% }
<%init>
my %opt = @_;
my $selected_cdrbatch = $opt{'curr_value'}; # || $opt{'value'} necessary?
my $conf = new FS::Conf;
unless ( $opt{'cdrbatches'} ) {
my $sth = dbh->prepare('SELECT DISTINCT cdrbatch FROM cdr')
or die dbh->errstr;
$sth->execute or die $sth->errstr;
my %cdrbatches = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
@{ $opt{'cdrbatches'} } = grep $_, keys %cdrbatches;
}
%init>