X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=2f70d654d87f085526d240aa2daf3082f28c0d64;hb=23c97b258b9b60d558af333166940f11c229f71c;hp=f11a28db914fbba500505acda944c3393a86b21f;hpb=c0567c688084e89fcd11bf82348b6c418f1254ac;p=freeside.git diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index f11a28db9..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,11 +116,28 @@ 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; - ''; - + $self->SUPER::check; } =item agent_type @@ -145,7 +168,7 @@ sub pkgpart_hashref { =head1 VERSION -$Id: agent.pm,v 1.3 2002-03-24 18:23:47 ivan Exp $ +$Id: agent.pm,v 1.6 2003-09-30 15:01:46 ivan Exp $ =head1 BUGS