summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-04-10 18:04:12 +0000
committerivan <ivan>2011-04-10 18:04:12 +0000
commitae9fe834eabeb6e0bf3d39b5f5ee1eb22203b345 (patch)
treea9cf6b1265ad91810f2aa07558744309b244b7ae
parent8a76ec0177f2622ef393eba89f65c123a796502f (diff)
fix CDR links on svc_phone when using a default_prefix, RT#12338
-rw-r--r--httemplate/search/cdr.html13
-rw-r--r--httemplate/view/svc_phone.cgi31
2 files changed, 29 insertions, 15 deletions
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html
index 6ee544e0e..bf59ff625 100644
--- a/httemplate/search/cdr.html
+++ b/httemplate/search/cdr.html
@@ -168,10 +168,15 @@ if ( $cgi->param('src') =~ $phonenum ) {
push @search, "src = '$src'";
}
-if ( $cgi->param('dst') =~ $phonenum ) {
- ( my $dst = $1 ) =~ s/$x//g;
- $hashref->{'dst'} = $dst;
- push @search, "dst = '$dst'";
+if ( $cgi->param('dst') ) {
+
+ my @d = map { $_, "1$_" } split(/\s*,\s*/, $cgi->param('dst') );
+
+ my $search = 'dst IN ('. join(',', map dbh->quote($_), @d). ')';
+
+ push @search, $search;
+ push @qsearch, $search;
+
}
if ( $cgi->param('dcontext') =~ /^\s*(.+)\s*$/ ) {
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index 4a850c21c..6e40fea54 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -135,21 +135,30 @@ my $html_foot = sub {
unless $svc_phone->countrycode eq '1';
#src & charged party as per voip_cdr.pm
- my $search;
+ #XXX handle toll free too
+
+ my $search = "charged_party_or_src=";
+
my $cust_pkg = $svc_phone->cust_svc->cust_pkg;
- if ( $cust_pkg && $cust_pkg->part_pkg->option('disable_src',1) ) {
- $search = "charged_party=$number";
- } else {
- $search = "charged_party_or_src=$number";
+
+ if ( $cust_pkg ) {
+
+ #XXX handle voip_inbound too
+
+ my @part_pkg = grep { $_->plan eq 'voip_cdr' }
+ $cust_pkg->part_pkg->self_and_bill_linked;
+
+ foreach my $prefix (grep $_, map $_->option('default_prefix'), @part_pkg) {
+ $number .= ",$prefix$number";
+ }
+
+ $search = 'charged_party='
+ unless !@part_pkg || grep { ! $_->option('disable_src',1) } @part_pkg;
+
}
- #XXX default prefix as per voip_cdr.pm
- #XXX handle toll free too
+ $search .= $number;
- #my @links = map {
- # qq(<A HREF="${p}search/cdr.html?src=$number;freesidestatus=$what{$_}">).
- # "View $_ CDRs</A>";
- #} keys(%what);
my @links = map {
qq(<A HREF="${p}search/cdr.html?cdrbatchnum=__ALL__;$search;freesidestatus=$what{$_}">).
"View $_ CDRs</A>";