X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-cdrbatch.html;h=034db3afda84b965a077d5e9115ba43ef615569f;hp=866ba25161c6838b0155e3742a298cd9458b8797;hb=HEAD;hpb=c47123a101c99b35c3c7b1be5b003b773ae00e06 diff --git a/httemplate/elements/select-cdrbatch.html b/httemplate/elements/select-cdrbatch.html index 866ba2516..034db3afd 100644 --- a/httemplate/elements/select-cdrbatch.html +++ b/httemplate/elements/select-cdrbatch.html @@ -1,38 +1,14 @@ -% if ( scalar(@{ $opt{'cdrbatches'} }) ) { - - - -% } else { - - - -% } - +<% include( '/elements/select-table.html', + 'table' => 'cdr_batch', + 'name_col' => 'cdrbatch', + 'curr_value' => $cdrbatchnum, + 'empty_label' => '(none)', + 'pre_options' => [ '__ALL__' => 'All' ], + ) +%> <%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; - -} +my $cdrbatchnum = $opt{'curr_value'}; # || $opt{'value'} necessary? -