diff options
Diffstat (limited to 'httemplate/elements/tr-select-cdrbatch.html')
-rw-r--r-- | httemplate/elements/tr-select-cdrbatch.html | 18 |
1 files changed, 8 insertions, 10 deletions
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 ) { - <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'cdrbatch' %>" VALUE="<% $selected_cdrbatch %>"> + <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'cdrbatchnum' %>" VALUE="__ALL__"> % } 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> |