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