diff options
author | Mark Wells <mark@freeside.biz> | 2015-05-15 10:18:12 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-05-15 10:18:18 -0700 |
commit | 7ad052da94c4d205cf426c0ef3ef113f5429b948 (patch) | |
tree | 321e139f5a7a92b30168a744fff632ad08ac131f /fs_selfservice/FS-SelfService | |
parent | 049272bb77e02c5b62885fd2ad302e0c34da4a19 (diff) |
view svc_pbx usage in selfservice, #34836
Diffstat (limited to 'fs_selfservice/FS-SelfService')
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 2 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/view_usage.html | 24 |
2 files changed, 15 insertions, 11 deletions
diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 9443a7de7..d039cfd4d 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -943,7 +943,7 @@ sub delete_svc { sub view_usage { my $res = list_svcs( 'session_id' => $session_id, - 'svcdb' => [ 'svc_acct', 'svc_phone', 'svc_port', ], + 'svcdb' => [ 'svc_acct', 'svc_phone', 'svc_port', 'svc_pbx' ], 'ncancelled' => 1, ); if ($res->{hide_usage}) { diff --git a/fs_selfservice/FS-SelfService/cgi/view_usage.html b/fs_selfservice/FS-SelfService/cgi/view_usage.html index 2aa7c1efb..4099a57f5 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_usage.html +++ b/fs_selfservice/FS-SelfService/cgi/view_usage.html @@ -3,6 +3,7 @@ @svc_acct = (); @svc_phone = (); @svc_port = (); + @svc_pbx = (); foreach (@svcs) { $by_pkg_label{ $_->{pkg_label} } ||= []; @@ -13,6 +14,8 @@ push @svc_phone, $_; } elsif ( $_->{svcdb} eq 'svc_port' ) { push @svc_port, $_; + } elsif ( $_->{svcdb} eq 'svc_pbx' ) { + push @svc_pbx, $_; } } ''; @@ -74,10 +77,10 @@ <%= scalar(@svc_acct) ? '</TABLE><BR><BR>' : '' %> -<%= if ( @svc_phone ) { +<%= if ( @svc_phone or @svc_pbx ) { %any = (); for my $dir (qw(outbound inbound)) { - $any{$dir} = grep { $_->{$dir} } @svc_phone; + $any{$dir} = grep { $_->{$dir} } (@svc_phone, @svc_pbx); } $OUT.= '<FONT SIZE="4">Call usage</FONT><BR><BR> <TABLE BGCOLOR="#cccccc" STYLE="display:inline-block"> @@ -97,21 +100,22 @@ } %> -<%= foreach my $svc_phone ( @svc_phone ) { - my $link = "${url}view_cdr_details;". - "svcnum=$svc_phone->{'svcnum'};beginning=0;ending=0"; - $OUT .= '<TR><TD>'. $svc_phone->{'label'}. ': '. $svc_phone->{'value'}; +<%= foreach my $svc_x ( @svc_phone, @svc_pbx ) { + my $link = $url . 'view_cdr_details;' . + 'svcnum='.$svc_x->{'svcnum'}. + ';beginning=0;ending=0'; + $OUT .= '<TR><TD>'. $svc_x->{'label'}. ': '. $svc_x->{'value'}; $OUT .= '</TD>'; # usage summary w/ links for my $dir (qw(outbound inbound)) { if ( $dir eq 'inbound' ) { $link .= ';inbound=1'; } - if ( $svc_phone->{$dir} ) { + if ( $svc_x->{$dir} ) { $OUT .= '<TD ALIGN="right">'.qq!<A HREF="$link">! . sprintf('%d calls (%.0f minutes)', - $svc_phone->{$dir}->{'count'}, - $svc_phone->{$dir}->{'duration'} / 60 + $svc_x->{$dir}->{'count'}, + $svc_x->{$dir}->{'duration'} / 60 ) . '</A></TD>'; } elsif ( $any{$dir} ) { @@ -154,7 +158,7 @@ '<TD COLSPAN=4>* shared among all your phone plans</TD></TR>'; } } -if ( scalar(@svc_phone) or scalar(@usage_pools) ) { +if ( @svc_phone or @svc_pbx or @usage_pools ) { $OUT .= '</TABLE><BR><BR>'; } ''; |