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