From 9229bcb6a2a0ef85af50bfa243bba8fdc85eba6d Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 19 Nov 2009 09:47:15 +0000 Subject: proper cdr_batch table, RT#6386 --- httemplate/elements/tr-select-cdrbatch.html | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'httemplate/elements/tr-select-cdrbatch.html') 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]; -- cgit v1.2.1