[freeside-commits] freeside/httemplate/elements tr-select-cdrbatch.html, NONE, 1.1 select-cdrbatch.html, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Thu Aug 28 18:09:11 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv30317/httemplate/elements

Added Files:
	tr-select-cdrbatch.html select-cdrbatch.html 
Log Message:
add CDR batch TFTP feature, RT#3113

--- NEW FILE: tr-select-cdrbatch.html ---
% if ( ! scalar(@{ $opt{'cdrbatches'} }) ) { 

  <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'cdrbatch' %>" VALUE="<% $selected_cdrbatch %>">

% } else { 

  <TR>
    <TD ALIGN="right"><% $opt{'cdrbatch'} || 'CDR Batch: ' %></TD>
    <TD>
      <% include( '/elements/select-cdrbatch.html', 'curr_value' => $selected_cdrbatch, %opt ) %>
    </TD>
  </TR>

% } 
<%init>

my( %opt ) = @_;
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;

}

</%init>


--- NEW FILE: select-cdrbatch.html ---
% 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__">

% }

<%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;

}

</%init>




More information about the freeside-commits mailing list