Initial revision
[freeside.git] / htdocs / docs / man / agent.txt
1 NAME
2     FS::agent - Object methods for agent records
3
4 SYNOPSIS
5       use FS::agent;
6
7       $record = create FS::agent \%hash;
8       $record = create FS::agent { 'column' => 'value' };
9
10       $error = $record->insert;
11
12       $error = $new_record->replace($old_record);
13
14       $error = $record->delete;
15
16       $error = $record->check;
17
18 DESCRIPTION
19     An FS::agent object represents an agent. Every customer has an
20     agent. Agents can be used to track things like resellers or
21     salespeople. FS::agent inherits from FS::Record. The following
22     fields are currently supported:
23
24     agemtnum - primary key (assigned automatically for new agents)
25     agent - Text name of this agent
26     typenum - Agent type.  See the FS::agent_type manpage
27     prog - For future use.
28     freq - For future use.
29 METHODS
30     create HASHREF
31         Creates a new agent. To add the agent to the database, see
32         the section on "insert".
33
34     insert
35         Adds this agent to the database. If there is an error,
36         returns the error, otherwise returns false.
37
38     delete
39         Deletes this agent from the database. Only agents with no
40         customers can be deleted. If there is an error, returns the
41         error, otherwise returns false.
42
43     replace OLD_RECORD
44         Replaces OLD_RECORD with this one in the database. If there
45         is an error, returns the error, otherwise returns false.
46
47     check
48         Checks all fields to make sure this is a valid agent. If
49         there is an error, returns the error, otherwise returns
50         false. Called by the insert and replace methods.
51
52 BUGS
53     It doesn't properly override FS::Record yet.
54
55 SEE ALSO
56     the FS::Record manpage, the FS::agent_type manpage, the
57     FS::cust_main manpage, schema.html from the base documentation.
58
59 HISTORY
60     Class dealing with agent (resellers)
61
62     ivan@sisd.com 97-nov-13, 97-dec-10
63
64     pod, added check in ->delete ivan@sisd.com 98-sep-22
65