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