X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fagent.pm;h=2f70d654d87f085526d240aa2daf3082f28c0d64;hb=243b248a929e99a9cc64e16f29e4a49afeb87a3c;hp=1afe7064117a21dee75e5b9dbd88dad7ad60712e;hpb=9951dac925264910d664b50d2fc33cf3dc1c734e;p=freeside.git diff --git a/FS/FS/agent.pm b/FS/FS/agent.pm index 1afe70641..2f70d654d 100644 --- a/FS/FS/agent.pm +++ b/FS/FS/agent.pm @@ -40,7 +40,7 @@ from FS::Record. The following fields are currently supported: =over 4 -=item agemtnum - primary key (assigned automatically for new agents) +=item agentnum - primary key (assigned automatically for new agents) =item agent - Text name of this agent @@ -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.2 2000-12-03 13:45:15 ivan Exp $ +$Id: agent.pm,v 1.6 2003-09-30 15:01:46 ivan Exp $ =head1 BUGS