[freeside-commits] freeside/httemplate/elements tr-select-cdrbatch.html, 1.1, 1.1.4.1 select-cdrbatch.html, 1.1, 1.1.4.1
Ivan,,,
ivan at wavetail.420.am
Thu Nov 19 01:47:17 PST 2009
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv32372/httemplate/elements
Modified Files:
Tag: FREESIDE_1_9_BRANCH
tr-select-cdrbatch.html select-cdrbatch.html
Log Message:
proper cdr_batch table, RT#6386
Index: tr-select-cdrbatch.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-cdrbatch.html,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- tr-select-cdrbatch.html 29 Aug 2008 01:09:09 -0000 1.1
+++ tr-select-cdrbatch.html 19 Nov 2009 09:47:15 -0000 1.1.4.1
@@ -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 $conf = new FS::Conf;
my $selected_cdrbatch = $opt{'curr_value'}; # || $opt{'value'} necessary?
-unless ( $opt{'cdrbatches'} ) {
-
- 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;
+$opt{'records'} = delete $opt{'cdr_batch'}
+ if $opt{'cdr_batch'};
-}
+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>
Index: select-cdrbatch.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-cdrbatch.html,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -d -r1.1 -r1.1.4.1
--- select-cdrbatch.html 29 Aug 2008 01:09:09 -0000 1.1
+++ select-cdrbatch.html 19 Nov 2009 09:47:15 -0000 1.1.4.1
@@ -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>
-
More information about the freeside-commits
mailing list