DEL out voided payments to distinguish them visually better
[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_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>setup - setup fee expression
272         <li>freq - recurring frequency (months)
273         <li>recur - recurring fee expression
274         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
275         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
276         <li>plan - price plan
277         <li>plandata - additional price plan data
278         <li>disabled - Disabled flag, empty or `Y'
279       </ul>
280     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
281       <ul>
282         <li>refnum - primary key
283         <li>referral - referral
284       </ul>
285     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
286       <ul>
287         <li>svcpart - primary key
288         <li>svc - name of this service
289         <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
290         <li>disabled - Disabled flag, empty or `Y'
291 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
292         <li><i>table</i>__<i>field</i>_flag - null, D or F
293 -->
294       </ul>
295     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
296       <ul>
297         <li>columnnum - primary key
298         <li>svcpart - <a href="#part_svc">Service definition</a>
299         <li>columnname - column name in part_svc.svcdb table
300         <li>columnvalue - default or fixed value for the column
301         <li>columnflag - null, D or F
302       </ul>
303     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
304       <ul>
305         <li>pkgpart - <a href="#part_pkg">Package definition</a>
306         <li>svcpart - <a href="#part_svc">Service definition</a>
307         <li>quantity - quantity of this service that this package includes
308         <li>primary_svc - blank or Y: primary service
309       </ul>
310     <li><a name="export_svc" href="man/FS/export_svc.html">export_svc</a>
311       <ul>
312         <li>exportsvcnum - primary key
313         <li>svcpart - <a href="#part_svc">Service definition</a>
314         <li>exportnum - <a href="#exportnum">Export</a>
315       </ul>
316     <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
317       <ul>
318         <li>exportnum - primary key
319         <li>machine - Machine name 
320         <li>exporttype - Export type
321         <li>nodomain - blank or Y: usernames are exported to this service with no domain
322       </ul>
323     <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
324       <ul>
325         <li>optionnum - primary key
326         <li>exportnum - <a href="#part_export">Export</a>
327         <li>optionname - option name
328         <li>optionvalue - option value
329       </ul>
330     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
331       <ul>
332         <li>portnum - primary key
333         <li>ip - IP address of this port
334         <li>nasport - port number on the NAS
335         <li>nasnum - <a href="#nas">NAS</a>
336       </ul>
337     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
338       <ul>
339         <li>prepaynum - primary key
340         <li>identifier - text or numeric string used to receive this credit
341         <li>amount - amount of credit
342       </ul>
343     <li><a name="session" href="man/FS/session.html">session</a>
344       <ul>
345         <li>sessionnum - primary key
346         <li>portnum - <a href="#port">Port</a>
347         <li>svcnum - <a href="#svc_acct">Account</a>
348         <li>login - timestamp indicating the beginning of this user session.
349         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
350       </ul>
351
352     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
353       <ul>
354         <li>svcnum - <a href="#cust_svc">primary key</a>
355         <li>username
356         <li>_password
357         <li>sec_phrase - security phrase
358         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
359         <li>uid
360         <li>gid
361         <li>finger - GECOS
362         <li>dir
363         <li>shell
364         <li>quota - (unimplementd)
365         <li>slipip - IP address
366         <li>seconds
367         <li>domsvc
368         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
369         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
370       </ul>
371     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
372       <ul>
373         <li>popnum - primary key
374         <li>city
375         <li>state
376         <li>ac - area code
377         <li>exch - exchange
378         <li>loc - rest of number
379       </ul>
380     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
381       <ul>
382         <li>localnum - primary key
383         <li>popnum - primary key
384         <li>city
385         <li>state
386         <li>npa - area code
387         <li>nxx - exchange
388       </ul>
389     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
390       <ul>
391         <li>svcnum - <a href="#cust_svc">primary key</a>
392         <li>domain
393       </ul>
394     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
395       <ul>
396         <li>svcnum - <a href="#cust_svc">primary key</a>
397         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
398         <li>src - literal source (username or full email address)
399         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
400         <li>dst - literal destination (username or full email address)
401       </ul>
402     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
403       <ul>
404         <li>recnum - primary key
405         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
406         <li>reczone - zone for this line
407         <li>recaf - address family, usually <b>IN</b>
408         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
409         <li>recdata - data for this record
410       </ul>
411     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
412       <ul>
413        <li>svcnum - <a href="#cust-svc">primary key</a>
414        <li>recnum - <a href="#domain_record">host</a>
415        <li>usersvc - <a href="#svc_acct">account</a>
416       </ul>
417     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
418       <ul>
419         <li>typenum - <a href="#agent_type">agent type</a>
420         <li>pkgpart - <a href="#part_pkg">Package definition</a>
421       </ul>
422     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
423       <ul>
424         <li>jobnum - primary key
425         <li>job
426         <li>_date
427         <li>status
428         <li>statustext
429         <li>svcnum
430       </ul>
431     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
432       <ul>
433         <li>argnum - primary key
434         <li>jobnum - <a href="#queue">job</a>
435         <li>arg - argument
436       </ul>
437     <li><a name="queue_depend" href="man/FS/queue_depend.html">queue_depend</a> - job dependancies
438       <ul>
439         <li>dependnum - primary key
440         <li>jobnum - source jobnum
441         <li>depend_jobnum - dependancy jobnum
442       </ul>
443     <li><a name="radius_usergroup" href="man/FS/radius_usergroup.html">radius_usergroup</a> - Link users to RADIUS groups.
444       <ul>
445         <li>usergroupnum - primary key
446         <li>svcnum - <a href="#svc_acct">account</a>
447         <li>groupname
448       </ul>
449     <li><a name="msgcat" href="man/FS/msgcat.html">msgcat</a> - i18n message catalog
450       <ul>
451         <li>msgnum - primary key
452         <li>msgcode - message code
453         <li>locale - locale
454         <li>msg - Message text
455       </ul>
456   </ul>
457 </body>