[freeside-commits] freeside/FS/FS/part_export broadband_sqlradius.pm, 1.3, 1.4

Mark Wells mark at wavetail.420.am
Thu Dec 8 13:42:08 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory wavetail.420.am:/tmp/cvs-serv9868/FS/FS/part_export

Modified Files:
	broadband_sqlradius.pm 
Log Message:
select case of MAC address for export, #15478

Index: broadband_sqlradius.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/broadband_sqlradius.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- broadband_sqlradius.pm	7 Dec 2011 21:35:03 -0000	1.3
+++ broadband_sqlradius.pm	8 Dec 2011 21:42:06 -0000	1.4
@@ -26,6 +26,11 @@
 #    type  => 'checkbox',
 #    label => 'Hide IP address on session reports',
 #  },
+  'mac_case' => {
+    label => 'Export MAC address as',
+    type  => 'select',
+    options => [ qw(uppercase lowercase) ],
+  },
   'mac_delimiter' => {
     label => 'Separate MAC address octets with',
     default => '-',
@@ -71,10 +76,19 @@
 
 sub rebless { shift; }
 
+sub _mac_format {
+  my $self = shift;
+  my $addr = shift;
+  if ( $self->option('mac_case',1) eq 'lowercase' ) {
+    $addr = lc($addr);
+  }
+  join( ($self->option('mac_delimiter',1) || ''), $addr =~ /../g );
+}
+
 sub export_username {
   my($self, $svc_broadband) = (shift, shift);
   my $mac_addr = $svc_broadband->mac_addr;
-  join( ($self->option('mac_delimiter',1) || ''), $mac_addr =~ /../g );
+  $self->_mac_format($svc_broadband->mac_addr);
 }
 
 sub radius_reply {
@@ -92,9 +106,7 @@
   my $password_attrib = $conf->config('radius-password') || 'Password';
   my %check;
   if ( $self->option('mac_as_password') ) {
-    my $mac_addr = $svc_broadband->mac_addr;
-    $check{$password_attrib} =
-      join( ($self->option('mac_delimiter',1) || ''), $mac_addr =~ /../g );
+    $check{$password_attrib} = $self->_mac_format($svc_broadband->mac_addr);
   }
   elsif ( length( $self->option('radius_password',1)) ) {
     $check{$password_attrib} = $self->option('radius_password');



More information about the freeside-commits mailing list