25ed652dad0b74033e5f83eac5fca23643466218
[freeside.git] / htdocs / docs / man / FS / agent_type.html
1 <HTML>
2 <HEAD>
3 <TITLE>FS::agent_type - Object methods for agent_type records</TITLE>
4 <LINK REV="made" HREF="mailto:ivan@rootwood.sisd.com">
5 </HEAD>
6
7 <BODY>
8
9 <!-- INDEX BEGIN -->
10
11 <UL>
12
13         <LI><A HREF="#NAME">NAME</A>
14         <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
15         <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
16         <LI><A HREF="#METHODS">METHODS</A>
17         <LI><A HREF="#VERSION">VERSION</A>
18         <LI><A HREF="#BUGS">BUGS</A>
19         <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
20 </UL>
21 <!-- INDEX END -->
22
23 <HR>
24 <P>
25 <H1><A NAME="NAME">NAME</A></H1>
26 <P>
27 FS::agent_type - Object methods for agent_type records
28
29 <P>
30 <HR>
31 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
32 <P>
33 <PRE>  use FS::agent_type;
34 </PRE>
35 <P>
36 <PRE>  $record = new FS::agent_type \%hash;
37   $record = new FS::agent_type { 'column' =&gt; 'value' };
38 </PRE>
39 <P>
40 <PRE>  $error = $record-&gt;insert;
41 </PRE>
42 <P>
43 <PRE>  $error = $new_record-&gt;replace($old_record);
44 </PRE>
45 <P>
46 <PRE>  $error = $record-&gt;delete;
47 </PRE>
48 <P>
49 <PRE>  $error = $record-&gt;check;
50 </PRE>
51 <P>
52 <PRE>  $hashref = $record-&gt;pkgpart_hashref;
53   #may purchase $pkgpart if $hashref-&gt;{$pkgpart};
54 </PRE>
55 <P>
56 <PRE>  @type_pkgs = $record-&gt;type_pkgs;
57 </PRE>
58 <P>
59 <PRE>  @pkgparts = $record-&gt;pkgpart;
60 </PRE>
61 <P>
62 <HR>
63 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
64 <P>
65 An FS::agent_type object represents an agent type. Every agent (see
66 <A HREF="../FS/agent.html">FS::agent</A>) has an agent type. Agent types define which packages (see
67 <A HREF="../FS/part_pkg.html">FS::part_pkg</A>) may be purchased by customers (see <A HREF="../FS/cust_main.html">FS::cust_main</A>), via FS::type_pkgs records (see <A HREF="../FS/type_pkgs.html">FS::type_pkgs</A>). FS::agent_type inherits from FS::Record. The following fields are
68 currently supported:
69
70 <DL>
71 <DT><STRONG><A NAME="item_typenum">typenum - primary key (assigned automatically for new agent types)</A></STRONG><DD>
72 <DT><STRONG><A NAME="item_atype">atype - Text name of this agent type</A></STRONG><DD>
73 </DL>
74 <P>
75 <HR>
76 <H1><A NAME="METHODS">METHODS</A></H1>
77 <DL>
78 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><DD>
79 <P>
80 Creates a new agent type. To add the agent type to the database, see
81 <A HREF="#insert">insert</A>.
82
83 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><DD>
84 <P>
85 Adds this agent type to the database. If there is an error, returns the
86 error, otherwise returns false.
87
88 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><DD>
89 <P>
90 Deletes this agent type from the database. Only agent types with no agents
91 can be deleted. If there is an error, returns the error, otherwise returns
92 false.
93
94 <DT><STRONG><A NAME="item_replace">replace OLD_RECORD</A></STRONG><DD>
95 <P>
96 Replaces OLD_RECORD with this one in the database. If there is an error,
97 returns the error, otherwise returns false.
98
99 <DT><STRONG><A NAME="item_check">check</A></STRONG><DD>
100 <P>
101 Checks all fields to make sure this is a valid agent type. If there is an
102 error, returns the error, otherwise returns false. Called by the insert and
103 replace methods.
104
105 <DT><STRONG><A NAME="item_pkgpart_hashref">pkgpart_hashref</A></STRONG><DD>
106 <P>
107 Returns a hash reference. The keys of the hash are pkgparts. The value is
108 true iff this agent may purchase the specified package definition. See
109 <A HREF="../FS/part_pkg.html">FS::part_pkg</A>.
110
111 <DT><STRONG><A NAME="item_type_pkgs">type_pkgs</A></STRONG><DD>
112 <P>
113 Returns all FS::type_pkgs objects (see <A HREF="../FS/type_pkgs.html">FS::type_pkgs</A>) for this agent type.
114
115 <DT><STRONG><A NAME="item_pkgpart">pkgpart</A></STRONG><DD>
116 <P>
117 Returns the pkgpart of all package definitions (see <A HREF="../FS/part_pkg.html">FS::part_pkg</A>) for this agent type.
118
119 </DL>
120 <P>
121 <HR>
122 <H1><A NAME="VERSION">VERSION</A></H1>
123 <P>
124 $Id: agent_type.html,v 1.1 1999-08-04 12:13:27 ivan Exp $
125
126 <P>
127 <HR>
128 <H1><A NAME="BUGS">BUGS</A></H1>
129 <P>
130 <HR>
131 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
132 <P>
133 <A HREF="../FS/Record.html">FS::Record</A>, <A HREF="../FS/agent.html">FS::agent</A>, <A HREF="../FS/type_pkgs.html">FS::type_pkgs</A>, <A HREF="../FS/cust_main.html">FS::cust_main</A>,
134 <A HREF="../FS/part_pkg.html">FS::part_pkg</A>, schema.html from the base documentation.
135
136 </BODY>
137
138 </HTML>