X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fsearch%2Fsqlradius.cgi;h=5d6aeea1efe52481b93a7e1b35ae54ef438e3961;hb=01717353564b79dd143220ec67207a2d245f24e9;hp=c8f7932c530542fc1a7be5c65448a7449826d7b4;hpb=d4e7a23cc00ce65a85c824efbaf569199c40299b;p=freeside.git
diff --git a/httemplate/search/sqlradius.cgi b/httemplate/search/sqlradius.cgi
index c8f7932c5..5d6aeea1e 100644
--- a/httemplate/search/sqlradius.cgi
+++ b/httemplate/search/sqlradius.cgi
@@ -4,11 +4,8 @@
% # and finally, display the thing
% ###
%
-% foreach my $part_export (
-% #grep $_->can('usage_sessions'), qsearch( 'part_export' )
-% qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
-% qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } )
-% ) {
+% foreach my $part_export ( @part_export ) {
+%
% %user2svc = ();
%
% my $efields = tie my %efields, 'Tie::IxHash', %fields;
@@ -16,21 +13,12 @@
% 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 %>
+
+ <% $part_export->exportname || $part_export->exporttype |h %>
+ <% $part_export->machine ? ' to '. $part_export->machine : '' |h %>
+
+
<% include( '/elements/table-grid.html' ) %>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
@@ -150,6 +138,23 @@ if ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
$cgi_svc = qsearchs( 'svc_acct', { 'username' => $1 } );
}
+my @part_export = ();
+if ( $cgi_svc ) {
+ my $part_svc = $cgi_svc->cust_svc->part_svc;
+ @part_export = (
+ $part_svc->part_export('sqlradius'),
+ $part_svc->part_export('sqlradius_withdomain'),
+ $part_svc->part_export('broadband_sqlradius'),
+ );
+} else {
+ @part_export = (
+ #grep $_->can('usage_sessions'), qsearch( 'part_export' )
+ qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ),
+ qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } ),
+ qsearch( 'part_export', { 'exporttype' => 'broadband_sqlradius' } ),
+ );
+}
+
my $ip = '';
if ( $cgi->param('ip') =~ /^((\d+\.){3}\d+)$/ ) {
$ip = $1;
@@ -297,10 +302,10 @@ my $duration_format = sub {
my $octets_format = sub {
my $octets = shift;
- my $megs = $octets / 1048576;
- sprintf('%.3f megs', $megs);
- #my $gigs = $octets / 1073741824
- #sprintf('%.3f gigabytes', $gigs);
+ #my $megs = $octets / 1048576;
+ #sprintf('%.3f megs', $megs);
+ my $gigs = $octets / 1073741824;
+ sprintf('%.3f gigs', $gigs);
};
###
@@ -368,6 +373,37 @@ tie %fields, 'Tie::IxHash',
},
align => 'right',
},
+ 'callingstationid' => {
+ name => 'Source or MAC',
+ attrib => 'Calling-Station-Id',
+ fmt => sub {
+ my $src = shift;
+ if ( $src =~
+ /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i ) {
+ return $src. ' ('.
+ (Net::MAC::Vendor::lookup($1))->[0].
+ ')';
+
+ }
+ length($src) ? $src : ' ';
+ },
+ align => 'right',
+ },
+ 'calledstationid' => {
+ name => 'Destination',
+ attrib => 'Called-Station-ID',
+ fmt => sub {
+ my $dst = shift;
+ if ( $dst =~
+ /^\s*(([\dA-F]{2}[\-:]){5}[\dA-F]{2})/i ) {
+ return $dst. ' ('.
+ (Net::MAC::Vendor::lookup($1))->[0].
+ ')';
+ }
+ length($dst) ? $dst : ' ';
+ },
+ align => 'left',
+ },
'acctstarttime' => {
name => 'Start time',
attrib => 'Acct-Start-Time',