8a27e0118764302c822693ee60d21d5ba24dc2ff
[freeside.git] / httemplate / docs / schema.html
1 <head>
2   <title>Schema reference</title>
3 </head>
4 <body>
5   <h1>Schema reference</h1>
6   Schema diagram: <a href="schema.png">as a giant .png</a> or <a href="schema.dia">dia source</a> (<a href="http://www.lysator.liu.se/~alla/dia/">dia homepage</a>).
7   <ul>
8     <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).
9       <ul>
10         <li>agentnum - primary key
11         <li>agent - name of this agent
12         <li>typenum - <a href="#agent_type">agent type</a>
13         <li>prog - (unimplemented)
14         <li>freq - (unimplemented)
15         <li>disabled - Disabled flag, empty or 'Y'
16         <li>username - Username for the Agent interface
17         <li>_password - Password for the Agent interface
18       </ul>
19     <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.
20       <ul>
21         <li>typenum - primary key
22         <li>atype - name of this agent type
23       </ul>
24     <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>.
25       <ul>
26         <li>invnum - primary key
27         <li>custnum - <a href="#cust_main">customer</a>
28         <li>_date
29         <li>charged - amount of this invoice
30         <li>printed - how many times this invoice has been printed automatically
31         <li>closed - books closed flag, empty or `Y'
32       </ul>
33     <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
34       <ul>
35         <li>eventnum - primary key
36         <li>invnum - <a href="#cust_bill">invoice</a>
37         <li>eventpart - <a href="#part_bill_event">event definition</a>
38         <li>_date
39         <li>status
40         <li>statustext
41       </ul>
42     <li><a name="part_bill_event" href="man/FS/part_bill_event.html">part_bill_event</a> - Invoice event definitions
43       <ul>
44         <li>eventpart - primary key
45         <li>payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, or COMP
46         <li>event - event name
47         <li>eventcode - event action
48         <li>seconds - how long after the invoice date (<a href="#cust_bill">cust_bill</a>._date) events of this type are triggered
49         <li>weight - ordering for events with identical seconds
50         <li>plan - eventcode plan
51         <li>plandata - additional plan data
52         <li>disabled - Disabled flag, empty or `Y'
53         <li>taxclass - Texas tax class flag, empty or "none", "access", or "hosting"
54       </ul>
55     <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
56       <ul>
57         <li>invnum - (multiple) key
58         <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
59         <li>setup - setup fee 
60         <li>recur - recurring fee
61         <li>sdate - starting date
62         <li>edate - ending date
63         <li>itemdesc - Line item description (currently used only when pkgnum is 0)
64       </ul>
65     <li><a name="cust_bill_pkg_detail" href="man/FS/cust_bill_pkg_detail.html">cust_bill_pkg_detail</a> - Invoice line items detail
66       <ul>
67         <li>detailnum - primary key
68         <li>pkgnum -
69         <li>invnum - 
70         <li>detail - Detail description
71       </ul>
72     <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.
73       <ul>
74         <li>crednum - primary key
75         <li>custnum - <a href="#cust_main">customer</a>
76         <li>amount - amount credited
77         <li>_date
78         <li>otaker - order taker
79         <li>reason
80         <li>closed - books closed flag, empty or `Y'
81       </ul>
82     <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.
83       <ul>
84         <li>creditbillnum - primary key
85         <li>crednum - <a href="#cust_credit">credit</a> being applied
86         <li>invnum - <a href="#cust_bill">invoice</a> to which credit is applied
87         <li>amount - amount applied
88         <li>_date
89       </ul>
90     <li><a name="cust_pay_refund" href="man/FS/cust_pay_refund.html">cust_credit_bill</a> - Refund payment application.  Links a refund to a payment.
91       <ul>
92         <li>payrefundnum - primary key
93         <li>paynum - <a href="#cust_pay">payment</a>
94         <li>refundnum - <a href="#cust_refund">refund</a>
95         <li>amount - amount applied
96         <li>_date
97       </ul>
98     <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
99       <ul>
100         <li>custnum - primary key
101         <li>agentnum - <a href="#agent">agent</a>
102         <li>refnum - <a href="#part_referral">referral</a>
103         <li>first - name
104         <li>last - name
105         <li>ss - social security number
106         <li>company
107         <li>address1
108         <li>address2
109         <li>city
110         <li>county
111         <li>state
112         <li>zip
113         <li>country
114         <li>daytime - phone
115         <li>night - phone
116         <li>fax - phone
117         <li><i>ship_first</i>
118         <li><i>ship_last</i>
119         <li><i>ship_company</i>
120         <li><i>ship_address1</i>
121         <li><i>ship_address2</i>
122         <li><i>ship_city</i>
123         <li><i>ship_county</i>
124         <li><i>ship_state</i>
125         <li><i>ship_zip</i>
126         <li><i>ship_country</i>
127         <li><i>ship_daytime</i>
128         <li><i>ship_night</i>
129         <li><i>ship_fax</i>
130         <li>payby - CARD, DCHK, CHEK, DCHK, LECB, BILL, or COMP
131         <li>payinfo - card number, P.O.#, or comp issuer
132         <li>paycvv - Card Verification Value, "CVV2" (also known as CVC2 or CID), the 3 or 4 digit number on the back (or front, for American Express) of the credit card
133         <li>paydate - expiration date
134         <li>payname - billing name (name on card)
135         <li>tax - tax exempt, Y or null
136         <li>otaker - order taker
137         <li>referral_custnum
138         <li>comments
139       </ul>
140       (columns in <i>italics</i> are optional)
141     <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.
142       <ul>
143         <li>destnum - primary key
144         <li>custnum - <a href="#cust_main">customer</a>
145         <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.
146       </ul>
147     <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
148       <ul>
149         <li>taxnum - primary key
150         <li>state
151         <li>county
152         <li>country
153         <li>tax - % rate
154         <li>taxclass
155         <li>exempt_amount
156         <li>taxname - if defined, printed on invoices instead of "Tax"
157         <li>setuptax - if 'Y', this tax does not apply to setup fees
158         <li>recurtax - if 'Y', this tax does not apply to recurring fees
159       </ul>
160     <li><a name="cust_tax_exempt" href="man/FS/cust_tax_exempt.html">cust_tax_exempt</a> - Tax exemption record
161       <ul>
162         <li>exemptnum - primary key
163         <li>taxnum - <a href="#cust_main_county">tax rate</a>
164         <li>year
165         <li>month
166         <li>amount
167       </ul>
168     <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
169       <ul>
170         <li>paynum - primary key
171         <li>custnum - <a href="#cust_main">customer</a>
172         <li>paid - amount
173         <li>_date
174         <li>payby - CARD, CHEK, LECB, BILL, or COMP
175         <li>payinfo - card number, P.O.#, or comp issuer
176         <li>paybatch - text field for tracking card processor batches
177         <li>closed - books closed flag, empty or `Y'
178       </ul>
179     <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.
180       <ul>
181         <li>billpaynum
182         <li>invnum - <a href="#cust_bill">invoice</a>
183         <li>paynum - <a href="#cust_pay">payment</a>
184         <li>amount
185         <li>_date
186       </ul>
187     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
188       <ul>
189         <li>paybatchnum
190         <li>cardnum
191         <li>exp - card expiration
192         <li>amount
193         <li>invnum - <a href="#cust_bill">invoice</a>
194         <li>custnum - <a href="#cust_main">customer</a>
195         <li>payname - name on card
196         <li>first - name
197         <li>last - name
198         <li>address1
199         <li>address2
200         <li>city
201         <li>state
202         <li>zip
203         <li>country
204       </ul>
205     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
206       <ul>
207         <li>pkgnum - primary key
208         <li>custnum - <a href="#cust_main">customer</a>
209         <li>pkgpart - <a href="#part_pkg">Package definition</a>
210         <li>setup - date
211         <li>bill - next bill date
212         <li>last_bill - last bill date
213         <li>susp - (past) suspension date
214         <li>expire - (future) cancellation date
215         <li>cancel - (past) cancellation date
216         <li>otaker - order taker
217         <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.
218       </ul>
219     <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.
220       <ul>
221         <li>refundnum - primary key
222         <li>custnum - <a href="#cust_main">customer</a>
223         <li>refund - amount
224         <li>_date
225         <li>payby - CARD, CHEK, LECB, BILL or COMP
226         <li>payinfo - card number, P.O.#, or comp issuer
227         <li>otaker - order taker
228         <li>closed - books closed flag, empty or `Y'
229       </ul>
230     <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.
231       <ul>
232         <li>creditrefundnum - primary key
233         <li>crednum - <a href="#cust_credit">credit</a>
234         <li>refundnum - <a href="#cust_refund">refund</a>
235         <li>amount
236         <li>_date
237       </ul>
238     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
239       <ul>
240         <li>svcnum - primary key
241         <li>pkgnum - <a href="#cust_pkg">package</a>
242         <li>svcpart - <a href="#part_svc">Service definition</a>
243       </ul>
244     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
245       <ul>
246         <li>nasnum - primary key
247         <li>nas - NAS name
248         <li>nasip - NAS ip address
249         <li>nasfqdn - NAS fully-qualified domain name
250         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
251       </ul>
252     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
253       <ul>
254         <li>pkgpart - primary key
255         <li>pkg - package name
256         <li>comment - non-customer visable package comment
257         <li>setup - setup fee expression
258         <li>freq - recurring frequency (months)
259         <li>recur - recurring fee expression
260         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
261         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
262         <li>plan - price plan
263         <li>plandata - additional price plan data
264         <li>disabled - Disabled flag, empty or `Y'
265       </ul>
266     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
267       <ul>
268         <li>refnum - primary key
269         <li>referral - referral
270       </ul>
271     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
272       <ul>
273         <li>svcpart - primary key
274         <li>svc - name of this service
275         <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
276         <li>disabled - Disabled flag, empty or `Y'
277 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
278         <li><i>table</i>__<i>field</i>_flag - null, D or F
279 -->
280       </ul>
281     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
282       <ul>
283         <li>columnnum - primary key
284         <li>svcpart - <a href="#part_svc">Service definition</a>
285         <li>columnname - column name in part_svc.svcdb table
286         <li>columnvalue - default or fixed value for the column
287         <li>columnflag - null, D or F
288       </ul>
289     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
290       <ul>
291         <li>pkgpart - <a href="#part_pkg">Package definition</a>
292         <li>svcpart - <a href="#part_svc">Service definition</a>
293         <li>quantity - quantity of this service that this package includes
294         <li>primary_svc - blank or Y: primary service
295       </ul>
296     <li><a name="export_svc" href="man/FS/export_svc.html">export_svc</a>
297       <ul>
298         <li>exportsvcnum - primary key
299         <li>svcpart - <a href="#part_svc">Service definition</a>
300         <li>exportnum - <a href="#exportnum">Export</a>
301       </ul>
302     <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
303       <ul>
304         <li>exportnum - primary key
305         <li>machine - Machine name 
306         <li>exporttype - Export type
307         <li>nodomain - blank or Y: usernames are exported to this service with no domain
308       </ul>
309     <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
310       <ul>
311         <li>optionnum - primary key
312         <li>exportnum - <a href="#part_export">Export</a>
313         <li>optionname - option name
314         <li>optionvalue - option value
315       </ul>
316     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
317       <ul>
318         <li>portnum - primary key
319         <li>ip - IP address of this port
320         <li>nasport - port number on the NAS
321         <li>nasnum - <a href="#nas">NAS</a>
322       </ul>
323     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
324       <ul>
325         <li>prepaynum - primary key
326         <li>identifier - text or numeric string used to receive this credit
327         <li>amount - amount of credit
328       </ul>
329     <li><a name="session" href="man/FS/session.html">session</a>
330       <ul>
331         <li>sessionnum - primary key
332         <li>portnum - <a href="#port">Port</a>
333         <li>svcnum - <a href="#svc_acct">Account</a>
334         <li>login - timestamp indicating the beginning of this user session.
335         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
336       </ul>
337
338     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
339       <ul>
340         <li>svcnum - <a href="#cust_svc">primary key</a>
341         <li>username
342         <li>_password
343         <li>sec_phrase - security phrase
344         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
345         <li>uid
346         <li>gid
347         <li>finger - GECOS
348         <li>dir
349         <li>shell
350         <li>quota - (unimplementd)
351         <li>slipip - IP address
352         <li>seconds
353         <li>domsvc
354         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
355         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
356       </ul>
357     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
358       <ul>
359         <li>popnum - primary key
360         <li>city
361         <li>state
362         <li>ac - area code
363         <li>exch - exchange
364         <li>loc - rest of number
365       </ul>
366     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
367       <ul>
368         <li>localnum - primary key
369         <li>popnum - primary key
370         <li>city
371         <li>state
372         <li>npa - area code
373         <li>nxx - exchange
374       </ul>
375     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
376       <ul>
377         <li>svcnum - <a href="#cust_svc">primary key</a>
378         <li>domain
379       </ul>
380     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
381       <ul>
382         <li>svcnum - <a href="#cust_svc">primary key</a>
383         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
384         <li>src - literal source (username or full email address)
385         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
386         <li>dst - literal destination (username or full email address)
387       </ul>
388     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
389       <ul>
390         <li>recnum - primary key
391         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
392         <li>reczone - zone for this line
393         <li>recaf - address family, usually <b>IN</b>
394         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
395         <li>recdata - data for this record
396       </ul>
397     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
398       <ul>
399        <li>svcnum - <a href="#cust-svc">primary key</a>
400        <li>recnum - <a href="#domain_record">host</a>
401        <li>usersvc - <a href="#svc_acct">account</a>
402       </ul>
403     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
404       <ul>
405         <li>typenum - <a href="#agent_type">agent type</a>
406         <li>pkgpart - <a href="#part_pkg">Package definition</a>
407       </ul>
408     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
409       <ul>
410         <li>jobnum - primary key
411         <li>job
412         <li>_date
413         <li>status
414         <li>statustext
415         <li>svcnum
416       </ul>
417     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
418       <ul>
419         <li>argnum - primary key
420         <li>jobnum - <a href="#queue">job</a>
421         <li>arg - argument
422       </ul>
423     <li><a name="queue_depend" href="man/FS/queue_depend.html">queue_depend</a> - job dependancies
424       <ul>
425         <li>dependnum - primary key
426         <li>jobnum - source jobnum
427         <li>depend_jobnum - dependancy jobnum
428       </ul>
429     <li><a name="radius_usergroup" href="man/FS/radius_usergroup.html">radius_usergroup</a> - Link users to RADIUS groups.
430       <ul>
431         <li>usergroupnum - primary key
432         <li>svcnum - <a href="#svc_acct">account</a>
433         <li>groupname
434       </ul>
435     <li><a name="msgcat" href="man/FS/msgcat.html">msgcat</a> - i18n message catalog
436       <ul>
437         <li>msgnum - primary key
438         <li>msgcode - message code
439         <li>locale - locale
440         <li>msg - Message text
441       </ul>
442   </ul>
443 </body>