$ip = $1;
}
+ my $prefix = $cgi->param('prefix');
+ $prefix =~ s/\D//g;
+ if ( $prefix =~ /^(\d+)$/ ) {
+ $prefix = $1;
+ $prefix = "011$prefix" unless $prefix =~ /^1/;
+ } else {
+ $prefix = '';
+ }
+
###
# field formatting subroutines
###
# and finally, display the thing
###
- foreach my $part_export ( map $_->rebless,
+ foreach my $part_export (
+ #grep $_->can('usage_sessions'), qsearch( 'part_export' )
qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } )
) {
%user2svc_acct = ();
+
+ my $efields = tie my %efields, 'Tie::IxHash', %fields;
+ delete $efields{'framedipaddress'} if $part_export->option('hide_ip');
+ if ( $part_export->option('hide_data') ) {
+ delete $efields{$_} foreach qw(acctinputoctets acctoutputoctets);
+ }
+ if ( $part_export->option('show_called_station') ) {
+ $efields->Splice(1, 0,
+ 'calledstationid' => {
+ 'name' => 'Destination',
+ 'attrib' => 'Called-Station-ID',
+ 'fmt' =>
+ sub { length($_[0]) ? shift : ' '; },
+ 'align' => 'left',
+ },
+ );
+ }
+
%>
<%= $part_export->exporttype %> to <%= $part_export->machine %><BR>
<%= include( '/elements/table.html' ) %>
<TR>
- <% foreach my $field ( keys %fields ) { %>
+ <% foreach my $field ( keys %efields ) { %>
<TH>
- <%= $fields{$field}->{name} %><BR>
- <FONT SIZE=-2><%= $fields{$field}->{attrib} %></FONT>
+ <%= $efields{$field}->{name} %><BR>
+ <FONT SIZE=-2><%= $efields{$field}->{attrib} %></FONT>
</TH>
<% } %>
</TR>
<% foreach my $session (
- @{ $part_export->usage_sessions( $beginning, $ending, $cgi_svc_acct, $ip ) }
-) { %>
+ @{ $part_export->usage_sessions(
+ $beginning, $ending, $cgi_svc_acct, $ip, $prefix, ) }
+ ) {
+%>
<TR>
- <% foreach my $field ( keys %fields ) { %>
- <TD ALIGN="<%= $fields{$field}->{align} %>">
- <%= &{ $fields{$field}->{fmt} }( $session->{$field},
+ <% foreach my $field ( keys %efields ) { %>
+ <TD ALIGN="<%= $efields{$field}->{align} %>">
+ <%= &{ $efields{$field}->{fmt} }( $session->{$field},
$session,
$part_export,
)