package FS::agent_type;
use strict;
-use vars qw(@ISA @EXPORT_OK);
-use Exporter;
-use FS::Record qw(qsearch fields);
+use vars qw( @ISA );
+use FS::Record qw( qsearch );
-@ISA = qw(FS::Record Exporter);
-@EXPORT_OK = qw(fields);
+@ISA = qw( FS::Record );
=head1 NAME
use FS::agent_type;
- $record = create FS::agent_type \%hash;
- $record = create FS::agent_type { 'column' => 'value' };
+ $record = new FS::agent_type \%hash;
+ $record = new FS::agent_type { 'column' => 'value' };
$error = $record->insert;
=over 4
-=item create HASHREF
+=item new HASHREF
Creates a new agent type. To add the agent type to the database, see
L<"insert">.
=cut
-sub create {
- my($proto,$hashref)=@_;
-
- #now in FS::Record::new
- #my($field);
- #foreach $field (fields('agent_type')) {
- # $hashref->{$field}='' unless defined $hashref->{$field};
- #}
-
- $proto->new('agent_type',$hashref);
-
-}
+sub table { 'agent_type'; }
=item insert
Adds this agent type to the database. If there is an error, returns the error,
otherwise returns false.
-=cut
-
-sub insert {
- my($self)=@_;
-
- $self->check or
- $self->add;
-}
-
=item delete
Deletes this agent type from the database. Only agent types with no agents
=cut
sub delete {
- my($self)=@_;
+ my $self = shift;
+
return "Can't delete an agent_type with agents!"
- if qsearch('agent',{'typenum' => $self->typenum});
- $self->del;
+ if qsearch( 'agent', { 'typenum' => $self->typenum } );
+
+ $self->SUPER::delete;
}
=item replace OLD_RECORD
Replaces OLD_RECORD with this one in the database. If there is an error,
returns the error, otherwise returns false.
-=cut
-
-sub replace {
- my($new,$old)=@_;
- return "(Old) Not a agent_type record!" unless $old->table eq "agent_type";
- return "Can't change typenum!"
- unless $old->getfield('typenum') eq $new->getfield('typenum');
- $new->check or
- $new->rep($old);
-}
-
=item check
Checks all fields to make sure this is a valid agent type. If there is an
=cut
sub check {
- my($self)=@_;
- return "Not a agent_type record!" unless $self->table eq "agent_type";
+ my $self = shift;
$self->ut_numbern('typenum')
or $self->ut_text('atype');
=back
-=head1 BUGS
+=head1 VERSION
+
+$Id: agent_type.pm,v 1.2 1998-12-29 11:59:35 ivan Exp $
-It doesn't properly override FS::Record yet.
+=head1 BUGS
=head1 SEE ALSO
pod, added check in delete ivan@sisd.com 98-sep-21
+$Log: agent_type.pm,v $
+Revision 1.2 1998-12-29 11:59:35 ivan
+mostly properly OO, some work still to be done with svc_ stuff
+
+
=cut
1;