summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2008-08-29 01:09:09 +0000
committerivan <ivan>2008-08-29 01:09:09 +0000
commitc47123a101c99b35c3c7b1be5b003b773ae00e06 (patch)
treeabecb0c0da3a7b65ce5d787960a852c5cb05fbad /httemplate
parentd7b220cb7443a6d55723e4b5b9d483504efe9250 (diff)
add CDR batch TFTP feature, RT#3113
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/select-cdrbatch.html38
-rw-r--r--httemplate/elements/tr-select-cdrbatch.html32
-rw-r--r--httemplate/search/cdr.html14
-rw-r--r--httemplate/search/report_cdr.html2
4 files changed, 86 insertions, 0 deletions
diff --git a/httemplate/elements/select-cdrbatch.html b/httemplate/elements/select-cdrbatch.html
new file mode 100644
index 0000000..866ba25
--- /dev/null
+++ b/httemplate/elements/select-cdrbatch.html
@@ -0,0 +1,38 @@
+% 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>
+
diff --git a/httemplate/elements/tr-select-cdrbatch.html b/httemplate/elements/tr-select-cdrbatch.html
new file mode 100644
index 0000000..21cd004
--- /dev/null
+++ b/httemplate/elements/tr-select-cdrbatch.html
@@ -0,0 +1,32 @@
+% 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>
+
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html
index 4bac8c1..0fa64c0 100644
--- a/httemplate/search/cdr.html
+++ b/httemplate/search/cdr.html
@@ -89,6 +89,20 @@ if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) {
OR charged_party = '1$charged_party' ) ";
}
+###
+# cdrbatch
+###
+
+if ( $cgi->param('cdrbatch') ne '__ALL__' ) {
+ if ( $cgi->param('cdrbatch') eq '' ) {
+ my $search = "( cdrbatch IS NULL OR cdrbatch = '' )";
+ push @qsearch, $search;
+ push @search, $search;
+ } else {
+ $hashref->{cdrbatch} = $cgi->param('cdrbatch');
+ push @search, 'cdrbatch = '. dbh->quote($cgi->param('cdrbatch'));
+ }
+}
###
# finish it up
diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html
index 1c19150..2851631 100644
--- a/httemplate/search/report_cdr.html
+++ b/httemplate/search/report_cdr.html
@@ -42,6 +42,8 @@
)
%>
+ <% include( '/elements/tr-select-cdrbatch.html' ) %>
+
</TABLE>
<BR>