818547e1c756303b74c2d04f9f3b4a61bcadd5ca
[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>paid - amount
104         <li>_date
105         <li>payby - CARD, BILL, or COMP
106         <li>payinfo - card number, P.O.#, or comp issuer
107         <li>paybatch - text field for tracking card processor batches
108       </ul>
109     <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.
110       <ul>
111         <li>billpaynum
112         <li>invnum - <a href="#cust_bill">invoice</a>
113         <li>paynum - <a href="#cust_pay">payment</a>
114         <li>amount
115         <li>_date
116       </ul>
117     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
118       <ul>
119         <li>trancode - 77 for charges
120         <li>cardnum
121         <li>exp - card expiration
122         <li>amount
123         <li>invnum - <a href="#cust_bill">invoice</a>
124         <li>custnum - <a href="#cust_main">customer</a>
125         <li>payname - name on card
126         <li>first - name
127         <li>last - name
128         <li>address1
129         <li>address2
130         <li>city
131         <li>state
132         <li>zip
133         <li>country
134       </ul>
135     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
136       <ul>
137         <li>pkgnum - primary key
138         <li>custnum - <a href="#cust_main">customer</a>
139         <li>pkgpart - <a href="#part_pkg">Package definition</a>
140         <li>setup - date
141         <li>bill - next bill date
142         <li>susp - (past) suspension date
143         <li>expire - (future) cancellation date
144         <li>cancel - (past) cancellation date
145         <li>otaker - order taker
146       </ul>
147     <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.
148       <ul>
149         <li>refundnum - primary key
150         <li>refund - amount
151         <li>_date
152         <li>payby - CARD, BILL or COMP
153         <li>payinfo - card number, P.O.#, or comp issuer
154         <li>otaker - order taker
155       </ul>
156     <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.
157       <ul>
158         <li>creditrefundnum - primary key
159         <li>crednum - <a href="#cust_credit">credit</a>
160         <li>refundnum - <a href="#cust_refund">refund</a>
161         <li>amount
162         <li>_date
163       </ul>
164     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
165       <ul>
166         <li>svcnum - primary key
167         <li>pkgnum - <a href="#cust_pkg">package</a>
168         <li>svcpart - <a href="#part_svc">Service definition</a>
169       </ul>
170     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
171       <ul>
172         <li>nasnum - primary key
173         <li>nas - NAS name
174         <li>nasip - NAS ip address
175         <li>nasfqdn - NAS fully-qualified domain name
176         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
177       </ul>
178     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
179       <ul>
180         <li>pkgpart - primary key
181         <li>pkg - package name
182         <li>comment - non-customer visable package comment
183         <li>setup - setup fee
184         <li>freq - recurring frequency (months)
185         <li>recur - recurring fee
186       </ul>
187     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
188       <ul>
189         <li>refnum - primary key
190         <li>referral - referral
191       </ul>
192     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
193       <ul>
194         <li>svcpart - primary key
195         <li>svc - name of this service
196         <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
197         <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
198         <li><i>table</i>__<i>field</i>_flag - null, D or F
199       </ul>
200     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
201       <ul>
202         <li>pkgpart - <a href="#part_pkg">Package definition</a>
203         <li>svcpart - <a href="#part_svc">Service definition</a>
204         <li>quantity - quantity of this service that this package includes
205       </ul>
206     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
207       <ul>
208         <li>portnum - primary key
209         <li>ip - IP address of this port
210         <li>nasport - port number on the NAS
211         <li>nasnum - <a href="#nas">NAS</a>
212       </ul>
213     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
214       <ul>
215         <li>prepaynum - primary key
216         <li>identifier - text or numeric string used to receive this credit
217         <li>amount - amount of credit
218       </ul>
219     <li><a name="session" href="man/FS/session.html">session</a>
220       <ul>
221         <li>sessionnum - primary key
222         <li>portnum - <a href="#port">Port</a>
223         <li>svcnum - <a href="#svc_acct">Account</a>
224         <li>login - timestamp indicating the beginning of this user session.
225         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
226       </ul>
227
228     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
229       <ul>
230         <li>svcnum - <a href="#cust_svc">primary key</a>
231         <li>username
232         <li>_password
233         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
234         <li>uid
235         <li>gid
236         <li>finger - GECOS
237         <li>dir
238         <li>shell
239         <li>quota - (unimplementd)
240         <li>slipip - IP address
241         <li>radius_<i>Radius_Attribute</i> - Radius-Attribute
242       </ul>
243     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
244       <ul>
245         <li>popnum - primary key
246         <li>city
247         <li>state
248         <li>ac - area code
249         <li>exch - exchange
250         <li>loc - rest of number
251       </ul>
252     <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
253       <ul>
254         <li>svcnum - <a href="#cust_svc">primary key</a>
255         <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum)
256         <li>domuid - <a href="#svc_acct">Account</a> (by uid)
257         <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a>
258       </ul>
259     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
260       <ul>
261         <li>svcnum - <a href="#cust_svc">primary key</a>
262         <li>domain
263       </ul>
264     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
265       <ul>
266         <li>svcnum - <a href="#cust_svc">primary key</a>
267         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
268         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
269         <li>dst - foreign destination (email address) - forward not local to freeside
270       </ul>
271     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
272       <ul>
273         <li>recnum - primary key
274         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
275         <li>reczone - zone for this line
276         <li>recaf - address family, usually <b>IN</b>
277         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
278         <li>recdata - data for this record
279       </ul>
280     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
281       <ul>
282        <li>svcnum - <a href="#cust-svc">primary key</a>
283        <li>recnum - <a href="#domain_record">host</a>
284        <li>usersvc - <a href="#svc_acct">account</a>
285       </ul>
286     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
287       <ul>
288         <li>typenum - <a href="#agent_type">agent type</a>
289         <li>pkgpart - <a href="#part_pkg">Package definition</a>
290       </ul>
291   </ul>
292 </body>