X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-cdrbatch.html;h=d080e2439e4a504018a61ca332ac9cd061a149a7;hb=e356f2ebb6564fe8d5333fc89bb4583ee3cd1fb1;hp=21cd004624875704bf6e43fc5185cc8b161bc0cd;hpb=c47123a101c99b35c3c7b1be5b003b773ae00e06;p=freeside.git
diff --git a/httemplate/elements/tr-select-cdrbatch.html b/httemplate/elements/tr-select-cdrbatch.html
index 21cd00462..d080e2439 100644
--- a/httemplate/elements/tr-select-cdrbatch.html
+++ b/httemplate/elements/tr-select-cdrbatch.html
@@ -1,6 +1,6 @@
-% if ( ! scalar(@{ $opt{'cdrbatches'} }) ) {
+% if ( ! $show ) {
-
+
% } else {
@@ -18,15 +18,13 @@ my( %opt ) = @_;
my $conf = new FS::Conf;
my $selected_cdrbatch = $opt{'curr_value'}; # || $opt{'value'} necessary?
-unless ( $opt{'cdrbatches'} ) {
+$opt{'records'} = delete $opt{'cdr_batch'}
+ if $opt{'cdr_batch'};
- 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;
-
-}
+my $sth = dbh->prepare('SELECT COUNT(*) FROM cdr_batch LIMIT 1')
+ or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my $show = $sth->fetchrow_arrayref->[0];
%init>