diff options
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/access_user.pm | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 8cc8b64fc..1bf6e9387 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -10,6 +10,7 @@ use FS::option_Common;  use FS::access_user_pref;  use FS::access_usergroup;  use FS::agent; +use FS::cust_main;  @ISA = qw( FS::m2m_Common FS::option_Common FS::Record );  #@ISA = qw( FS::m2m_Common FS::option_Common ); @@ -220,6 +221,9 @@ sub replace {        $dbh->rollback or die $dbh->errstr if $oldAutoCommit;        return $error;      } +  } elsif ( $old->disabled && !$new->disabled +              && $new->_password =~ /changeme/i ) { +    return "Must change password when enabling this account";    }    my $error = $new->SUPER::replace($old, @_); @@ -254,6 +258,7 @@ sub check {      || $self->ut_text('_password')      || $self->ut_text('last')      || $self->ut_text('first') +    || $self->ut_foreign_keyn('user_custnum', 'cust_main', 'custnum')      || $self->ut_enum('disabled', [ '', 'Y' ] )    ;    return $error if $error; @@ -272,6 +277,18 @@ sub name {    $self->get('last'). ', '. $self->first;  } +=item user_cust_main + +Returns the FS::cust_main object (see L<FS::cust_main>), if any, for this +user. + +=cut + +sub user_cust_main { +  my $self = shift; +  qsearchs( 'cust_main', { 'custnum' => $self->user_custnum } ); +} +  =item access_usergroup  Returns links to the the groups this user is a part of, as FS::access_usergroup | 
