X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcdr.html;h=a5575967c71b0e6dca3b4f92fe1d084a66dad50d;hb=17399ceae6086eff5a248910d40f34d811377b26;hp=d1f68c5c67f8244fb48d07df02952c332ea2c31b;hpb=a83a000a027d1272e813259d09230d701d84df64;p=freeside.git diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index d1f68c5c6..a5575967c 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -70,10 +70,11 @@ my @search = (); ### my $str2time_sql = str2time_sql; +my $closing = str2time_sql_closing; my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); -push @search, "$str2time_sql calldate) >= $beginning ", - "$str2time_sql calldate) <= $ending"; +push @search, "$str2time_sql calldate $closing >= $beginning ", + "$str2time_sql calldate $closing <= $ending"; ### # duration / billsec @@ -125,7 +126,7 @@ foreach my $param ( grep /^termpart\d+status$/, $cgi->param ) { $search = "NOT EXISTS ( SELECT 1 FROM cdr_termination WHERE $where_term )"; - } elsif ( $cgi->param('freesidestatus') =~ /^([\w ]+)$/ ) { + } elsif ( $status =~ /^([\w ]+)$/ ) { #false lazienss w/cdr_termination.pm (i should be a part_termination method) my $where_term = @@ -179,18 +180,31 @@ if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) { } ### -# cdrbatch +# cdrbatchnum (or legacy cdrbatch) ### -if ( $cgi->param('cdrbatch') ne '__ALL__' ) { - if ( $cgi->param('cdrbatch') eq '' ) { - my $search = "( cdrbatch IS NULL OR cdrbatch = '' )"; +if ( $cgi->param('cdrbatch') ) { + + my $cdr_batch = + qsearchs('cdr_batch', { 'cdrbatch' => scalar($cgi->param('cdrbatch')) } ); + if ( $cdr_batch ) { + $hashref->{cdrbatchnum} = $cdr_batch->cdrbatchnum; + push @search, 'cdrbatchnum = '. $cdr_batch->cdrbatchnum; + } else { + die "unknown cdrbatch ". $cgi->param('cdrbatch'); + } + +} elsif ( $cgi->param('cdrbatchnum') ne '__ALL__' ) { + + if ( $cgi->param('cdrbatchnum') eq '' ) { + my $search = "( cdrbatchnum IS NULL )"; push @qsearch, $search; push @search, $search; - } else { - $hashref->{cdrbatch} = $cgi->param('cdrbatch'); - push @search, 'cdrbatch = '. dbh->quote($cgi->param('cdrbatch')); + } elsif ( $cgi->param('cdrbatchnum') =~ /^(\d+)$/ ) { + $hashref->{cdrbatchnum} = $1; + push @search, "cdrbatchnum = $1"; } + } ###