% if ( ! scalar(@{ $opt{'cdrbatches'} }) ) {
% } else {
<% $opt{'cdrbatch'} || 'CDR Batch: ' %> |
<% include( '/elements/select-cdrbatch.html', 'curr_value' => $selected_cdrbatch, %opt ) %>
|
% }
<%init>
my( %opt ) = @_;
my $conf = new FS::Conf;
my $selected_cdrbatch = $opt{'curr_value'}; # || $opt{'value'} necessary?
unless ( $opt{'cdrbatches'} ) {
my $sth = dbh->prepare('SELECT 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>