diff options
| author | mark <mark> | 2011-12-08 21:42:15 +0000 | 
|---|---|---|
| committer | mark <mark> | 2011-12-08 21:42:15 +0000 | 
| commit | 492a9305157ad99f07dcc188a52666d1c5142ac7 (patch) | |
| tree | 6d3a4f3c27cb29a688c890215a5e5bd4bdf8eaa8 /FS | |
| parent | 3ab9b93b970353bfddc44b65bbb79d3aa586ded7 (diff) | |
select case of MAC address for export, #15478
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/part_export/broadband_sqlradius.pm | 20 | 
1 files changed, 16 insertions, 4 deletions
diff --git a/FS/FS/part_export/broadband_sqlradius.pm b/FS/FS/part_export/broadband_sqlradius.pm index dc117b05c..45f286f17 100644 --- a/FS/FS/part_export/broadband_sqlradius.pm +++ b/FS/FS/part_export/broadband_sqlradius.pm @@ -26,6 +26,11 @@ tie %options, 'Tie::IxHash',  #    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 @@ END  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 @@ sub radius_check {    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');  | 
