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