diff options
author | ivan <ivan> | 2009-11-19 09:47:15 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-11-19 09:47:15 +0000 |
commit | 9229bcb6a2a0ef85af50bfa243bba8fdc85eba6d (patch) | |
tree | bb5b0da7d8c2935d383c8d89132ae2b18236c002 /httemplate/elements/select-cdrbatch.html | |
parent | 086037ee00542de876713f1ef09db807e15cb88f (diff) |
proper cdr_batch table, RT#6386
Diffstat (limited to 'httemplate/elements/select-cdrbatch.html')
-rw-r--r-- | httemplate/elements/select-cdrbatch.html | 42 |
1 files changed, 9 insertions, 33 deletions
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'} }) ) { - - <SELECT NAME="<% $opt{'name'} || 'cdrbatch' %>"> - - <OPTION VALUE="__ALL__">All - <OPTION VALUE="">(blank) - -% foreach my $cdrbatch ( @{ $opt{'cdrbatches'} } ) { - <OPTION VALUE="<% $cdrbatch %>"<% $cdrbatch eq $selected_cdrbatch ? ' SELECTED' : '' %>><% $cdrbatch %> -% } - - </SELECT> - -% } else { - - <INPUT TYPE="hidden" NAME="cdrbatch" VALUE="__ALL__"> - -% } - +<% 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? </%init> - |