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