book closing schema changes
[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         <li>closed - books closed flag, empty or `Y'
28       </ul>
29     <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
30       <ul>
31         <li>eventnum - primary key
32         <li>invnum - <a href="#cust_bill">invoice</a>
33         <li>eventpart - <a href="#part_bill_event">event definition</a>
34         <li>_date
35       </ul>
36     <li><a name="part_bill_event" href="man/FS/part_bill_event.html">part_bill_event</a> - Invoice event definitions
37       <ul>
38         <li>eventpart - primary key
39         <li>payby - CARD, BILL, or COMP
40         <li>event - event name
41         <li>eventcode - event action
42         <li>seconds - how long after the invoice date (<a href="#cust_bill">cust_bill</a>._date) events of this type are triggered
43         <li>disabled - Disabled flag, empty or `Y'
44       </ul>
45     <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
46       <ul>
47         <li>invnum - (multiple) key
48         <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
49         <li>setup - setup fee 
50         <li>recur - recurring fee
51         <li>sdate - starting date
52         <li>edate - ending date
53       </ul>
54     <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.
55       <ul>
56         <li>crednum - primary key
57         <li>custnum - <a href="#cust_main">customer</a>
58         <li>amount - amount credited
59         <li>_date
60         <li>otaker - order taker
61         <li>reason
62         <li>closed - books closed flag, empty or `Y'
63       </ul>
64     <li><a name="cust_credit_bill" href="man/FS/cust_credit_bill.html">cust_credit_bill</a> - Credit invoice application.  Links a credit to an invoice.
65       <ul>
66         <li>creditbillnum - primary key
67         <li>crednum - <a href="#cust_credit">credit</a> being applied
68         <li>invnum - <a href="#cust_bill">invoice</a> to which credit is applied
69         <li>amount - amount applied
70         <li>_date
71       </ul>
72     <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
73       <ul>
74         <li>custnum - primary key
75         <li>agentnum - <a href="#agent">agent</a>
76         <li>refnum - <a href="#part_referral">referral</a>
77         <li>first - name
78         <li>last - name
79         <li>ss - social security number
80         <li>company
81         <li>address1
82         <li>address2
83         <li>city
84         <li>county
85         <li>state
86         <li>zip
87         <li>country
88         <li>daytime - phone
89         <li>night - phone
90         <li>fax - phone
91         <li><i>ship_first</i>
92         <li><i>ship_last</i>
93         <li><i>ship_company</i>
94         <li><i>ship_address1</i>
95         <li><i>ship_address2</i>
96         <li><i>ship_city</i>
97         <li><i>ship_county</i>
98         <li><i>ship_state</i>
99         <li><i>ship_zip</i>
100         <li><i>ship_country</i>
101         <li><i>ship_daytime</i>
102         <li><i>ship_night</i>
103         <li><i>ship_fax</i>
104         <li>payby - CARD, BILL, or COMP
105         <li>payinfo - card number, P.O.#, or comp issuer
106         <li>paydate - expiration date
107         <li>payname - billing name (name on card)
108         <li>tax - tax exempt, Y or null
109         <li>otaker - order taker
110         <li>referral_custnum
111         <li>comments
112       </ul>
113       (columns in <i>italics</i> are optional)
114     <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.
115       <ul>
116         <li>destnum - primary key
117         <li>custnum - <a href="#cust_main">customer</a>
118         <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.
119       </ul>
120     <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
121       <ul>
122         <li>taxnum - primary key
123         <li>state
124         <li>county
125         <li>country
126         <li>tax - % rate
127       </ul>
128     <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
129       <ul>
130         <li>paynum - primary key
131         <li>custnum - <a href="#cust_main">customer</a>
132         <li>paid - amount
133         <li>_date
134         <li>payby - CARD, BILL, or COMP
135         <li>payinfo - card number, P.O.#, or comp issuer
136         <li>paybatch - text field for tracking card processor batches
137         <li>closed - books closed flag, empty or `Y'
138       </ul>
139     <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.
140       <ul>
141         <li>billpaynum
142         <li>invnum - <a href="#cust_bill">invoice</a>
143         <li>paynum - <a href="#cust_pay">payment</a>
144         <li>amount
145         <li>_date
146       </ul>
147     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
148       <ul>
149         <li>paybatchnum
150         <li>cardnum
151         <li>exp - card expiration
152         <li>amount
153         <li>invnum - <a href="#cust_bill">invoice</a>
154         <li>custnum - <a href="#cust_main">customer</a>
155         <li>payname - name on card
156         <li>first - name
157         <li>last - name
158         <li>address1
159         <li>address2
160         <li>city
161         <li>state
162         <li>zip
163         <li>country
164       </ul>
165     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
166       <ul>
167         <li>pkgnum - primary key
168         <li>custnum - <a href="#cust_main">customer</a>
169         <li>pkgpart - <a href="#part_pkg">Package definition</a>
170         <li>setup - date
171         <li>bill - next bill date
172         <li>susp - (past) suspension date
173         <li>expire - (future) cancellation date
174         <li>cancel - (past) cancellation date
175         <li>otaker - order taker
176         <li>manual_flag - If this field is set to 1, disables the automatic unsuspensiond of this package when using the <a href="config.html#unsuspendauto">unsuspendauto</a> config file.
177       </ul>
178     <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.
179       <ul>
180         <li>refundnum - primary key
181         <li>custnum - <a href="#cust_main">customer</a>
182         <li>refund - amount
183         <li>_date
184         <li>payby - CARD, BILL or COMP
185         <li>payinfo - card number, P.O.#, or comp issuer
186         <li>otaker - order taker
187         <li>closed - books closed flag, empty or `Y'
188       </ul>
189     <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.
190       <ul>
191         <li>creditrefundnum - primary key
192         <li>crednum - <a href="#cust_credit">credit</a>
193         <li>refundnum - <a href="#cust_refund">refund</a>
194         <li>amount
195         <li>_date
196       </ul>
197     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
198       <ul>
199         <li>svcnum - primary key
200         <li>pkgnum - <a href="#cust_pkg">package</a>
201         <li>svcpart - <a href="#part_svc">Service definition</a>
202       </ul>
203     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
204       <ul>
205         <li>nasnum - primary key
206         <li>nas - NAS name
207         <li>nasip - NAS ip address
208         <li>nasfqdn - NAS fully-qualified domain name
209         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
210       </ul>
211     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
212       <ul>
213         <li>pkgpart - primary key
214         <li>pkg - package name
215         <li>comment - non-customer visable package comment
216         <li>setup - setup fee expression
217         <li>freq - recurring frequency (months)
218         <li>recur - recurring fee expression
219         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
220         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
221         <li>plan - price plan
222         <li>plandata - additional price plan data
223         <li>disabled - Disabled flag, empty or `Y'
224       </ul>
225     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
226       <ul>
227         <li>refnum - primary key
228         <li>referral - referral
229       </ul>
230     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
231       <ul>
232         <li>svcpart - primary key
233         <li>svc - name of this service
234         <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
235         <li>disabled - Disabled flag, empty or `Y'
236 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
237         <li><i>table</i>__<i>field</i>_flag - null, D or F
238 -->
239       </ul>
240     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
241       <ul>
242         <li>columnnum - primary key
243         <li>svcpart - <a href="#part_svc">Service definition</a>
244         <li>columnname - column name in part_svc.svcdb table
245         <li>columnvalue - default or fixed value for the column
246         <li>columnflag - null, D or F
247       </ul>
248     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
249       <ul>
250         <li>pkgpart - <a href="#part_pkg">Package definition</a>
251         <li>svcpart - <a href="#part_svc">Service definition</a>
252         <li>quantity - quantity of this service that this package includes
253       </ul>
254     <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
255       <ul>
256         <li>exportnum - primary key
257         <li>svcpart - <a href="#part_svc">Service definition</a>
258         <li>machine - Machine name 
259         <li>exporttype - Export type
260         <li>nodomain - blank or Y: usernames are exported to this service with no domain
261       </ul>
262     <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
263       <ul>
264         <li>optionnum - primary key
265         <li>exportnum - <a href="#part_export">Export</a>
266         <li>option - option name
267         <li>optionvalue - option value
268       </ul>
269     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
270       <ul>
271         <li>portnum - primary key
272         <li>ip - IP address of this port
273         <li>nasport - port number on the NAS
274         <li>nasnum - <a href="#nas">NAS</a>
275       </ul>
276     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
277       <ul>
278         <li>prepaynum - primary key
279         <li>identifier - text or numeric string used to receive this credit
280         <li>amount - amount of credit
281       </ul>
282     <li><a name="session" href="man/FS/session.html">session</a>
283       <ul>
284         <li>sessionnum - primary key
285         <li>portnum - <a href="#port">Port</a>
286         <li>svcnum - <a href="#svc_acct">Account</a>
287         <li>login - timestamp indicating the beginning of this user session.
288         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
289       </ul>
290
291     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
292       <ul>
293         <li>svcnum - <a href="#cust_svc">primary key</a>
294         <li>username
295         <li>_password
296         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
297         <li>uid
298         <li>gid
299         <li>finger - GECOS
300         <li>dir
301         <li>shell
302         <li>quota - (unimplementd)
303         <li>slipip - IP address
304         <li>seconds
305         <li>domsvc
306         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
307         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
308       </ul>
309     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
310       <ul>
311         <li>popnum - primary key
312         <li>city
313         <li>state
314         <li>ac - area code
315         <li>exch - exchange
316         <li>loc - rest of number
317       </ul>
318     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
319       <ul>
320         <li>localnum - primary key
321         <li>popnum - primary key
322         <li>city
323         <li>state
324         <li>npa - area code
325         <li>nxx - exchange
326       </ul>
327     <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
328       <ul>
329         <li>svcnum - <a href="#cust_svc">primary key</a>
330         <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum)
331         <li>domuid - <a href="#svc_acct">Account</a> (by uid)
332         <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a>
333       </ul>
334     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
335       <ul>
336         <li>svcnum - <a href="#cust_svc">primary key</a>
337         <li>domain
338       </ul>
339     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
340       <ul>
341         <li>svcnum - <a href="#cust_svc">primary key</a>
342         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
343         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
344         <li>dst - foreign destination (email address) - forward not local to freeside
345       </ul>
346     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
347       <ul>
348         <li>recnum - primary key
349         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
350         <li>reczone - zone for this line
351         <li>recaf - address family, usually <b>IN</b>
352         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
353         <li>recdata - data for this record
354       </ul>
355     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
356       <ul>
357        <li>svcnum - <a href="#cust-svc">primary key</a>
358        <li>recnum - <a href="#domain_record">host</a>
359        <li>usersvc - <a href="#svc_acct">account</a>
360       </ul>
361     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
362       <ul>
363         <li>typenum - <a href="#agent_type">agent type</a>
364         <li>pkgpart - <a href="#part_pkg">Package definition</a>
365       </ul>
366     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
367       <ul>
368         <li>jobnum - primary key
369         <li>job
370         <li>_date
371         <li>status
372       </ul>
373     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
374       <ul>
375         <li>argnum - primary key
376         <li>jobnum - <a href="#queue">job</a>
377         <li>arg - argument
378       </ul>
379   </ul>
380 </body>