$error = $record->cancel;
+ %hash = $record->radius;
+
=head1 DESCRIPTION
An FS::svc_acct object represents an account. FS::svc_acct inherits from
$recref->{username} = $1;
$recref->{username} =~ /[a-z]/ or return "Illegal username";
- $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum";
+ $recref->{popnum} =~ /^(\d*)$/ or return "Illegal popnum: ".$recref->{popnum};
$recref->{popnum} = $1;
return "Unkonwn popnum" unless
! $recref->{popnum} ||
;
unless ( $recref->{username} eq 'sync' ) {
- my($shell);
- if ( $shell = (grep $_ eq $recref->{shell}, @shells)[0] ) {
- $recref->{shell} = $shell;
+ if ( grep $_ eq $recref->{shell}, @shells ) {
+ $recref->{shell} = (grep $_ eq $recref->{shell}, @shells)[0];
} else {
return "Illegal shell \`". $self->shell. "\'; ".
$conf->dir. "/shells contains: @shells";
#$recref->{password} = $1.
# crypt($3,$saltset[int(rand(64))].$saltset[int(rand(64))]
#;
- } elsif ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([\w\.\/]{13,24})$/ ) {
+ } elsif ( $recref->{_password} =~ /^((\*SUSPENDED\* )?)([\w\.\/\$]{13,34})$/ ) {
$recref->{_password} = $1.$3;
} elsif ( $recref->{_password} eq '*' ) {
$recref->{_password} = '*';
''; #no error
}
+=item radius
+
+Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
+attributes of this record.
+
+Note that this is now the preferred method for reading RADIUS attributes -
+accessing the columns directly is discouraged, as the column names are
+expected to change in the future.
+
+=cut
+
+sub radius {
+ my $self = shift;
+ map {
+ /^(radius_(.*))$/;
+ my($column, $attrib) = ($1, $2);
+ $attrib =~ s/_/\-/g;
+ ( $attrib, $self->getfield($column) );
+ } grep { /^radius_/ && $self->getfield($_) } fields( $self->table );
+}
+
=back
=head1 VERSION
-$Id: svc_acct.pm,v 1.2 1999-08-12 00:05:03 ivan Exp $
+$Id: svc_acct.pm,v 1.8 2000-07-04 13:42:37 ivan Exp $
=head1 BUGS
The $recref stuff in sub check should be cleaned up.
+The suspend, unsuspend and cancel methods update the database, but not the
+current object. This is probably a bug as it's unexpected and
+counterintuitive.
+
=head1 SEE ALSO
L<FS::svc_Common>, L<FS::Record>, L<FS::Conf>, L<FS::cust_svc>,