32c365ec38b356824a9a01bfc01c91961b922047
[freeside.git] / httemplate / docs / schema.html
1 <head>
2   <title>Schema reference</title>
3 </head>
4 <body>
5   <h1>Schema reference</h1>
6   <ul>
7     <li><a name="agent" href="man/FS/agent.html">agent</a> - Agents are resellers of your service.  Agents may be limited to a subset of your full offerings (via their agent type).
8       <ul>
9         <li>agentnum - primary key
10         <li>agent - name of this agent
11         <li>typenum - <a href="#agent_type">agent type</a>
12         <li>prog - (unimplemented)
13         <li>freq - (unimplemented)
14       </ul>
15     <li><a name="agent_type" href="man/FS/agent_type.html">agent_type</a> - Agent types define groups of packages that you can then assign to particular agents.
16       <ul>
17         <li>typenum - primary key
18         <li>atype - name of this agent type
19       </ul>
20     <li><a name="cust_bill" href="man/FS/cust_bill.html">cust_bill</a> - Invoices.  Declarations that a customer owes you money.  The specific charges are itemized in <a href="#cust_bill_pkg">cust_bill_pkg</a>.
21       <ul>
22         <li>invnum - primary key
23         <li>custnum - <a href="#cust_main">customer</a>
24         <li>_date
25         <li>charged - amount of this invoice
26         <li>printed - how many times this invoice has been printed automatically
27       </ul>
28     <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
29       <ul>
30         <li>invnum - (multiple) key
31         <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
32         <li>setup - setup fee 
33         <li>recur - recurring fee
34         <li>sdate - starting date
35         <li>edate - ending date
36       </ul>
37     <li><a name="cust_credit" href="man/FS/cust_credit.html">cust_credit</a> - Credits.  The equivalent of a negative <a href="#cust_bill">cust_bill</a> record.
38       <ul>
39         <li>crednum - primary key
40         <li>custnum - <a href="#cust_main">customer</a>
41         <li>amount - amount credited
42         <li>_date
43         <li>otaker - order taker
44         <li>reason
45       </ul>
46     <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
47       <ul>
48         <li>custnum - primary key
49         <li>agentnum - <a href="#agent">agent</a>
50         <li>refnum - <a href="#part_referral">referral</a>
51         <li>first - name
52         <li>last - name
53         <li>ss - social security number
54         <li>company
55         <li>address1
56         <li>address2
57         <li>city
58         <li>county
59         <li>state
60         <li>zip
61         <li>country
62         <li>daytime - phone
63         <li>night - phone
64         <li>fax - phone
65         <li><i>ship_first</i>
66         <li><i>ship_last</i>
67         <li><i>ship_company</i>
68         <li><i>ship_address1</i>
69         <li><i>ship_address2</i>
70         <li><i>ship_city</i>
71         <li><i>ship_county</i>
72         <li><i>ship_state</i>
73         <li><i>ship_zip</i>
74         <li><i>ship_country</i>
75         <li><i>ship_daytime</i>
76         <li><i>ship_night</i>
77         <li><i>ship_fax</i>
78         <li>payby - CARD, BILL, or COMP
79         <li>payinfo - card number, P.O.#, or comp issuer
80         <li>paydate - expiration date
81         <li>payname - billing name (name on card)
82         <li>tax - tax exempt, Y or null
83         <li>otaker - order taker
84       </ul>
85       (columns in <i>italics</i> are optional)
86     <li><a name="cust_main_invoice" href="man/FS/cust_main_invoice.html">cust_main_invoice</a> - Invoice destinations for email invoices.  Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination.
87       <ul>
88         <li>destnum - primary key
89         <li>custnum - <a href="#cust_main">customer</a>
90         <li>dest - Invoice destination.  Freeside supports three types of invoice delivery: send directly to a service defined in Freeside, send to an arbitrary email address, or print the invoice to a printer and have someone send it out via snail mail.  Freeside determines which method to use based on the contents of the dest field.  If the contents are numeric, a <a href="#svc_acct">svcnum</a> pointing to a valid service is expected in the field.  If the contents are a string, a literal email address is expected to be in the field.  If the special keyword `POST' is present, the snail mail method is used (which is the default if no cust_main_invoice records exist).  Snail mail invoices get their address information from <A name="#cust_main">cust_main</A> and are printed with the printer defined in the configuration files.
91       </ul>
92     <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
93       <ul>
94         <li>taxnum - primary key
95         <li>state
96         <li>county
97         <li>country
98         <li>tax - % rate
99       </ul>
100     <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
101       <ul>
102         <li>paynum - primary key
103         <li>custnum - <a href="#cust_main">customer</a>
104         <li>paid - amount
105         <li>_date
106         <li>payby - CARD, BILL, or COMP
107         <li>payinfo - card number, P.O.#, or comp issuer
108         <li>paybatch - text field for tracking card processor batches
109       </ul>
110     <li><a name="cust_bill_pay" href="man/FS/cust_bill_pay.html">cust_bill_pay</a> - Applicaton of a payment to a specific invoice.
111       <ul>
112         <li>billpaynum
113         <li>invnum - <a href="#cust_bill">invoice</a>
114         <li>paynum - <a href="#cust_pay">payment</a>
115         <li>amount
116         <li>_date
117       </ul>
118     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
119       <ul>
120         <li>trancode - 77 for charges
121         <li>cardnum
122         <li>exp - card expiration
123         <li>amount
124         <li>invnum - <a href="#cust_bill">invoice</a>
125         <li>custnum - <a href="#cust_main">customer</a>
126         <li>payname - name on card
127         <li>first - name
128         <li>last - name
129         <li>address1
130         <li>address2
131         <li>city
132         <li>state
133         <li>zip
134         <li>country
135       </ul>
136     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
137       <ul>
138         <li>pkgnum - primary key
139         <li>custnum - <a href="#cust_main">customer</a>
140         <li>pkgpart - <a href="#part_pkg">Package definition</a>
141         <li>setup - date
142         <li>bill - next bill date
143         <li>susp - (past) suspension date
144         <li>expire - (future) cancellation date
145         <li>cancel - (past) cancellation date
146         <li>otaker - order taker
147       </ul>
148     <li><a name="cust_refund" href="man/FS/cust_refund.html">cust_refund</a> - Refunds.  The transfer of money to a customer; equivalent to a negative <a href="#cust_pay">cust_pay</a> record.
149       <ul>
150         <li>refundnum - primary key
151         <li>custnum - <a href="#cust_main">customer</a>
152         <li>refund - amount
153         <li>_date
154         <li>payby - CARD, BILL or COMP
155         <li>payinfo - card number, P.O.#, or comp issuer
156         <li>otaker - order taker
157       </ul>
158     <li><a name="cust_credit_refund" href="man/FS/cust_credit_refund.html">cust_credit_refund</a> - Applicaton of a refund to a specific credit.
159       <ul>
160         <li>creditrefundnum - primary key
161         <li>crednum - <a href="#cust_credit">credit</a>
162         <li>refundnum - <a href="#cust_refund">refund</a>
163         <li>amount
164         <li>_date
165       </ul>
166     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
167       <ul>
168         <li>svcnum - primary key
169         <li>pkgnum - <a href="#cust_pkg">package</a>
170         <li>svcpart - <a href="#part_svc">Service definition</a>
171       </ul>
172     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
173       <ul>
174         <li>nasnum - primary key
175         <li>nas - NAS name
176         <li>nasip - NAS ip address
177         <li>nasfqdn - NAS fully-qualified domain name
178         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
179       </ul>
180     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
181       <ul>
182         <li>pkgpart - primary key
183         <li>pkg - package name
184         <li>comment - non-customer visable package comment
185         <li>setup - setup fee
186         <li>freq - recurring frequency (months)
187         <li>recur - recurring fee
188       </ul>
189     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
190       <ul>
191         <li>refnum - primary key
192         <li>referral - referral
193       </ul>
194     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
195       <ul>
196         <li>svcpart - primary key
197         <li>svc - name of this service
198         <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
199 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
200         <li><i>table</i>__<i>field</i>_flag - null, D or F
201 -->
202       </ul>
203     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
204       <ul>
205         <li>columnnum - primary key
206         <li>svcpart - <a href="#part_svc">Service definition</a>
207         <li>columnname - column name in part_svc.svcdb table
208         <li>columnvalue - default or fixed value for the column
209         <li>columnflag - null, D or F
210       </ul>
211     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
212       <ul>
213         <li>pkgpart - <a href="#part_pkg">Package definition</a>
214         <li>svcpart - <a href="#part_svc">Service definition</a>
215         <li>quantity - quantity of this service that this package includes
216       </ul>
217     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
218       <ul>
219         <li>portnum - primary key
220         <li>ip - IP address of this port
221         <li>nasport - port number on the NAS
222         <li>nasnum - <a href="#nas">NAS</a>
223       </ul>
224     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
225       <ul>
226         <li>prepaynum - primary key
227         <li>identifier - text or numeric string used to receive this credit
228         <li>amount - amount of credit
229       </ul>
230     <li><a name="session" href="man/FS/session.html">session</a>
231       <ul>
232         <li>sessionnum - primary key
233         <li>portnum - <a href="#port">Port</a>
234         <li>svcnum - <a href="#svc_acct">Account</a>
235         <li>login - timestamp indicating the beginning of this user session.
236         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
237       </ul>
238
239     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
240       <ul>
241         <li>svcnum - <a href="#cust_svc">primary key</a>
242         <li>username
243         <li>_password
244         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
245         <li>uid
246         <li>gid
247         <li>finger - GECOS
248         <li>dir
249         <li>shell
250         <li>quota - (unimplementd)
251         <li>slipip - IP address
252         <li>seconds
253         <li>domsvc
254         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
255         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
256       </ul>
257     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
258       <ul>
259         <li>popnum - primary key
260         <li>city
261         <li>state
262         <li>ac - area code
263         <li>exch - exchange
264         <li>loc - rest of number
265       </ul>
266     <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
267       <ul>
268         <li>svcnum - <a href="#cust_svc">primary key</a>
269         <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum)
270         <li>domuid - <a href="#svc_acct">Account</a> (by uid)
271         <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a>
272       </ul>
273     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
274       <ul>
275         <li>svcnum - <a href="#cust_svc">primary key</a>
276         <li>domain
277       </ul>
278     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
279       <ul>
280         <li>svcnum - <a href="#cust_svc">primary key</a>
281         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
282         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
283         <li>dst - foreign destination (email address) - forward not local to freeside
284       </ul>
285     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
286       <ul>
287         <li>recnum - primary key
288         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
289         <li>reczone - zone for this line
290         <li>recaf - address family, usually <b>IN</b>
291         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
292         <li>recdata - data for this record
293       </ul>
294     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
295       <ul>
296        <li>svcnum - <a href="#cust-svc">primary key</a>
297        <li>recnum - <a href="#domain_record">host</a>
298        <li>usersvc - <a href="#svc_acct">account</a>
299       </ul>
300     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
301       <ul>
302         <li>typenum - <a href="#agent_type">agent type</a>
303         <li>pkgpart - <a href="#part_pkg">Package definition</a>
304       </ul>
305   </ul>
306 </body>