1 package FS::agent_type;
5 use FS::Record qw( qsearch );
7 @ISA = qw( FS::Record );
11 FS::agent_type - Object methods for agent_type records
17 $record = new FS::agent_type \%hash;
18 $record = new FS::agent_type { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::agent_type object represents an agent type. Every agent (see
31 L<FS::agent>) has an agent type. Agent types define which packages (see
32 L<FS::part_pkg>) may be purchased by customers (see L<FS::cust_main>), via
33 FS::type_pkgs records (see L<FS::type_pkgs>). FS::agent_type inherits from
34 FS::Record. The following fields are currently supported:
38 =item typenum - primary key (assigned automatically for new agent types)
40 =item atype - Text name of this agent type
50 Creates a new agent type. To add the agent type to the database, see
55 sub table { 'agent_type'; }
59 Adds this agent type to the database. If there is an error, returns the error,
60 otherwise returns false.
64 Deletes this agent type from the database. Only agent types with no agents
65 can be deleted. If there is an error, returns the error, otherwise returns
73 return "Can't delete an agent_type with agents!"
74 if qsearch( 'agent', { 'typenum' => $self->typenum } );
79 =item replace OLD_RECORD
81 Replaces OLD_RECORD with this one in the database. If there is an error,
82 returns the error, otherwise returns false.
86 Checks all fields to make sure this is a valid agent type. If there is an
87 error, returns the error, otherwise returns false. Called by the insert and
95 $self->ut_numbern('typenum')
96 or $self->ut_text('atype');
104 $Id: agent_type.pm,v 1.2 1998-12-29 11:59:35 ivan Exp $
110 L<FS::Record>, L<FS::agent>, L<FS::type_pkgs>, L<FS::cust_main>,
111 L<FS::part_pkg>, schema.html from the base documentation.
115 Class for the different sets of allowable packages you can assign to an
118 ivan@sisd.com 97-nov-13
120 ut_ FS::Record methods
121 ivan@sisd.com 97-dec-10
123 Changed 'type' to 'atype' because Pg6.3 reserves the type word
124 bmccane@maxbaud.net 98-apr-3
126 pod, added check in delete ivan@sisd.com 98-sep-21
128 $Log: agent_type.pm,v $
129 Revision 1.2 1998-12-29 11:59:35 ivan
130 mostly properly OO, some work still to be done with svc_ stuff