X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=2f70d654d87f085526d240aa2daf3082f28c0d64;hb=243b248a929e99a9cc64e16f29e4a49afeb87a3c;hp=6de15ae6f8327ff0f22d19ff178aa781ebe5962f;hpb=58d44fbe5eb9ab32e6d87063a4a3b22ddba9a828;p=freeside.git diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 6de15ae6f..2f70d654d 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -50,6 +50,12 @@ from FS::Record. The following fields are currently supported: =item freq - For future use. +=item disabled - Disabled flag, empty or 'Y' + +=item username - Username for the Agent interface + +=item _password - Password for the Agent interface + =back =head1 METHODS @@ -110,6 +116,24 @@ sub check { ; return $error if $error; + if ( $self->dbdef_table->column('disabled') ) { + $error = $self->ut_enum('disabled', [ '', 'Y' ] ); + return $error if $error; + } + + if ( $self->dbdef_table->column('username') ) { + $error = $self->ut_alphan('username'); + return $error if $error; + if ( length($self->username) ) { + my $conflict = qsearchs('agent', { 'username' => $self->username } ); + return 'duplicate agent username (with '. $conflict->agent. ')' + if $conflict; + $error = $self->ut_text('password'); # ut_text... arbitrary choice + } else { + $self->_password(''); + } + } + return "Unknown typenum!" unless $self->agent_type; @@ -144,7 +168,7 @@ sub pkgpart_hashref { =head1 VERSION -$Id: agent.pm,v 1.4 2003-08-05 00:20:40 khoff Exp $ +$Id: agent.pm,v 1.6 2003-09-30 15:01:46 ivan Exp $ =head1 BUGS