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