- bring prepaid support into this century (close: Bug#1124)
[freeside.git] / httemplate / docs / schema.html
1
2   <title>Schema reference</title>
3 </head>
4 <body>
5   <h1>Schema reference</h1>
6   Schema diagram (1.4.1): <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_pay-void" href="man/FS/cust_pay_void.html">cust_pay_void</a> - Voided payments.
180       <ul>
181         <li>paynum - primary key
182         <li>custnum - <a href="#cust_main">customer</a>
183         <li>paid - amount
184         <li>_date
185         <li>payby - CARD, CHEK, LECB, BILL, or COMP
186         <li>payinfo - card number, P.O.#, or comp issuer
187         <li>paybatch - text field for tracking card processor batches
188         <li>closed - books closed flag, empty or `Y'
189         <li>void_date
190         <li>reason
191         <li>otaker - order taker
192       </ul>
193     <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.
194       <ul>
195         <li>billpaynum
196         <li>invnum - <a href="#cust_bill">invoice</a>
197         <li>paynum - <a href="#cust_pay">payment</a>
198         <li>amount
199         <li>_date
200       </ul>
201     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
202       <ul>
203         <li>paybatchnum
204         <li>cardnum
205         <li>exp - card expiration
206         <li>amount
207         <li>invnum - <a href="#cust_bill">invoice</a>
208         <li>custnum - <a href="#cust_main">customer</a>
209         <li>payname - name on card
210         <li>first - name
211         <li>last - name
212         <li>address1
213         <li>address2
214         <li>city
215         <li>state
216         <li>zip
217         <li>country
218       </ul>
219     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
220       <ul>
221         <li>pkgnum - primary key
222         <li>custnum - <a href="#cust_main">customer</a>
223         <li>pkgpart - <a href="#part_pkg">Package definition</a>
224         <li>setup - date
225         <li>bill - next bill date
226         <li>last_bill - last bill date
227         <li>susp - (past) suspension date
228         <li>expire - (future) cancellation date
229         <li>cancel - (past) cancellation date
230         <li>otaker - order taker
231         <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.
232       </ul>
233     <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.
234       <ul>
235         <li>refundnum - primary key
236         <li>custnum - <a href="#cust_main">customer</a>
237         <li>refund - amount
238         <li>_date
239         <li>payby - CARD, CHEK, LECB, BILL or COMP
240         <li>payinfo - card number, P.O.#, or comp issuer
241         <li>otaker - order taker
242         <li>closed - books closed flag, empty or `Y'
243       </ul>
244     <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.
245       <ul>
246         <li>creditrefundnum - primary key
247         <li>crednum - <a href="#cust_credit">credit</a>
248         <li>refundnum - <a href="#cust_refund">refund</a>
249         <li>amount
250         <li>_date
251       </ul>
252     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
253       <ul>
254         <li>svcnum - primary key
255         <li>pkgnum - <a href="#cust_pkg">package</a>
256         <li>svcpart - <a href="#part_svc">Service definition</a>
257       </ul>
258     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
259       <ul>
260         <li>nasnum - primary key
261         <li>nas - NAS name
262         <li>nasip - NAS ip address
263         <li>nasfqdn - NAS fully-qualified domain name
264         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
265       </ul>
266     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
267       <ul>
268         <li>pkgpart - primary key
269         <li>pkg - package name
270         <li>comment - non-customer visable package comment
271         <li>promo_code - promotional code
272         <li><i>deprecated</i> setup - setup fee expression
273         <li>freq - recurring frequency (months)
274         <li><i>deprecated</i> recur - recurring fee expression
275         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
276         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
277         <li>plan - price plan
278         <li><i>deprecated</i> plandata - additional price plan data
279         <li>disabled - Disabled flag, empty or `Y'
280       </ul>
281     <li><a name="part_pkg_option" href="man/FS/part_pkg_option.html">part_pkg_option</a> - Package definition options
282       <ul>
283         <li>optionnum - primary key
284         <li>pkgpart - <a href="#part_pkg">Package definition</a>
285         <li>optionname - option name
286         <li>optionvalue - option value
287       </ul>
288     <li><a name="reg_code" href="man/FS/reg_code.html">reg_code</A> - One-time registration codes
289       <ul>
290         <li>codenum - primary key
291         <li>code
292         <li>agentnum - <a href="#agent">Agent</a>
293       </ul>
294     <li><a name="reg_code_pkg" href="man/FS/reg_code_pkg.html">reg_code_pkg</A> - Registration code link to package definitions
295       <ul>
296         <li>codenum - <a href="#reg_code">Registration code</a>
297         <li>pkgpart - <a href="#part_pkg">Package definition</a>
298       </ul>
299     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
300       <ul>
301         <li>refnum - primary key
302         <li>referral - referral
303       </ul>
304     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
305       <ul>
306         <li>svcpart - primary key
307         <li>svc - name of this service
308         <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
309         <li>disabled - Disabled flag, empty or `Y'
310 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
311         <li><i>table</i>__<i>field</i>_flag - null, D or F
312 -->
313       </ul>
314     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
315       <ul>
316         <li>columnnum - primary key
317         <li>svcpart - <a href="#part_svc">Service definition</a>
318         <li>columnname - column name in part_svc.svcdb table
319         <li>columnvalue - default or fixed value for the column
320         <li>columnflag - null, D or F
321       </ul>
322     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
323       <ul>
324         <li>pkgpart - <a href="#part_pkg">Package definition</a>
325         <li>svcpart - <a href="#part_svc">Service definition</a>
326         <li>quantity - quantity of this service that this package includes
327         <li>primary_svc - blank or Y: primary service
328       </ul>
329     <li><a name="export_svc" href="man/FS/export_svc.html">export_svc</a>
330       <ul>
331         <li>exportsvcnum - primary key
332         <li>svcpart - <a href="#part_svc">Service definition</a>
333         <li>exportnum - <a href="#exportnum">Export</a>
334       </ul>
335     <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
336       <ul>
337         <li>exportnum - primary key
338         <li>machine - Machine name 
339         <li>exporttype - Export type
340         <li>nodomain - blank or Y: usernames are exported to this service with no domain
341       </ul>
342     <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
343       <ul>
344         <li>optionnum - primary key
345         <li>exportnum - <a href="#part_export">Export</a>
346         <li>optionname - option name
347         <li>optionvalue - option value
348       </ul>
349     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
350       <ul>
351         <li>portnum - primary key
352         <li>ip - IP address of this port
353         <li>nasport - port number on the NAS
354         <li>nasnum - <a href="#nas">NAS</a>
355       </ul>
356     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a> - prepaid cards
357       <ul>
358         <li>prepaynum - primary key
359         <li>identifier - text or numeric string of prepaid card
360         <li>amount - amount of prepayment
361         <li>seconds - prepaid time instead of (or in addition to) monetary value
362         <li>agentnum - optional agent assignment for prepaid cards
363       </ul>
364     <li><a name="session" href="man/FS/session.html">session</a>
365       <ul>
366         <li>sessionnum - primary key
367         <li>portnum - <a href="#port">Port</a>
368         <li>svcnum - <a href="#svc_acct">Account</a>
369         <li>login - timestamp indicating the beginning of this user session.
370         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
371       </ul>
372
373     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
374       <ul>
375         <li>svcnum - <a href="#cust_svc">primary key</a>
376         <li>username
377         <li>_password
378         <li>sec_phrase - security phrase
379         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
380         <li>uid
381         <li>gid
382         <li>finger - GECOS
383         <li>dir
384         <li>shell
385         <li>quota - (unimplementd)
386         <li>slipip - IP address
387         <li>seconds
388         <li>domsvc
389         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
390         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
391       </ul>
392     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
393       <ul>
394         <li>popnum - primary key
395         <li>city
396         <li>state
397         <li>ac - area code
398         <li>exch - exchange
399         <li>loc - rest of number
400       </ul>
401     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
402       <ul>
403         <li>localnum - primary key
404         <li>popnum - primary key
405         <li>city
406         <li>state
407         <li>npa - area code
408         <li>nxx - exchange
409       </ul>
410     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
411       <ul>
412         <li>svcnum - <a href="#cust_svc">primary key</a>
413         <li>domain
414       </ul>
415     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
416       <ul>
417         <li>svcnum - <a href="#cust_svc">primary key</a>
418         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
419         <li>src - literal source (username or full email address)
420         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
421         <li>dst - literal destination (username or full email address)
422       </ul>
423     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
424       <ul>
425         <li>recnum - primary key
426         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
427         <li>reczone - zone for this line
428         <li>recaf - address family, usually <b>IN</b>
429         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
430         <li>recdata - data for this record
431       </ul>
432     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
433       <ul>
434        <li>svcnum - <a href="#cust-svc">primary key</a>
435        <li>recnum - <a href="#domain_record">host</a>
436        <li>usersvc - <a href="#svc_acct">account</a>
437       </ul>
438     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
439       <ul>
440         <li>typenum - <a href="#agent_type">agent type</a>
441         <li>pkgpart - <a href="#part_pkg">Package definition</a>
442       </ul>
443     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
444       <ul>
445         <li>jobnum - primary key
446         <li>job
447         <li>_date
448         <li>status
449         <li>statustext
450         <li>svcnum
451       </ul>
452     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
453       <ul>
454         <li>argnum - primary key
455         <li>jobnum - <a href="#queue">job</a>
456         <li>arg - argument
457       </ul>
458     <li><a name="queue_depend" href="man/FS/queue_depend.html">queue_depend</a> - job dependancies
459       <ul>
460         <li>dependnum - primary key
461         <li>jobnum - source jobnum
462         <li>depend_jobnum - dependancy jobnum
463       </ul>
464     <li><a name="radius_usergroup" href="man/FS/radius_usergroup.html">radius_usergroup</a> - Link users to RADIUS groups.
465       <ul>
466         <li>usergroupnum - primary key
467         <li>svcnum - <a href="#svc_acct">account</a>
468         <li>groupname
469       </ul>
470     <li><a name="rate" href="man/FS/rate.html">rate</a> - Call rate plans
471       <ul>
472         <li>ratenum - primary key
473         <li>ratename
474       </ul>
475     <li><a name="rate_detail" href="man/FS/rate_detail.html">rate_detail</a> - Call rate detail
476       <ul>
477         <li>ratenum - <a href="#rate">rate plan</a>
478         <li>orig_regionnum - call origination <a href="#rate_region">region</a>
479         <li>dest_regionnum - call destination <a href="#rate_region">region</a>
480         <li>min_included - included minutes
481         <li>min_charge - charge per minute
482         <li>sec_granularity - granularity in seconds, i.e. 6 or 60
483       </ul>
484     <li><a name="rate_region" href="man/FS/rate_region.html">rate_region</a> - Call rate region
485       <ul>
486         <li>regionnum - primary key
487         <li>regionname
488       </ul>
489     <li><a name="rate_prefix" href="man/FS/rate_prefix.html">rate_prefix</a> - Call rate prefix
490       <ul>
491         <li>prefixnum - primary key
492         <li>regionnum - <a href="#rate_region">rate region</a>
493         <li>countrycode
494         <li>npa
495         <li>nxx
496       </ul>
497     <li><a name="msgcat" href="man/FS/msgcat.html">msgcat</a> - i18n message catalog
498       <ul>
499         <li>msgnum - primary key
500         <li>msgcode - message code
501         <li>locale - locale
502         <li>msg - Message text
503       </ul>
504     <li><a name="clientapi_session" href="man/FS/clientapi_session.html">clientapi_session</a> - ClientAPI session store
505       <ul>
506         <li>sessionnum - primary key
507         <li>sessionid - session ID
508         <li>namespace - session namespace
509       </ul>
510     <li><a name="clientapi_session_field" href="man/FS/clientapi_session_field.html">clientapi_session_field</a> - Client API session store data
511       <ul>
512         <li>fieldnum - primary key
513         <li>sessionnum - <a href="#session">session</a>
514         <li>fieldname
515         <li>fieldvalue
516       </ul>
517   </ul>
518 </body>