<title>Schema reference</title>
</head>
<body>
  <h1>Schema reference</h1>
  Schema diagram (1.4.1): <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>).
  <ul>
    <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).
      <ul>
        <li>agentnum - primary key
        <li>agent - name of this agent
        <li>typenum - <a href="#agent_type">agent type</a>
        <li>prog - (unimplemented)
        <li>freq - (unimplemented)
        <li>disabled - Disabled flag, empty or 'Y'
        <li>username - Username for the Agent interface
        <li>_password - Password for the Agent interface
      </ul>
    <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.
      <ul>
        <li>typenum - primary key
        <li>atype - name of this agent type
      </ul>
    <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>.
      <ul>
        <li>billpkgnum - primary_key
        <li>invnum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>_date
        <li>charged - amount of this invoice
        <li>printed - how many times this invoice has been printed automatically
        <li>closed - books closed flag, empty or `Y'
      </ul>
    <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
      <ul>
        <li>eventnum - primary key
        <li>invnum - <a href="#cust_bill">invoice</a>
        <li>eventpart - <a href="#part_bill_event">event definition</a>
        <li>_date
        <li>status
        <li>statustext
      </ul>
    <li><a name="part_bill_event" href="man/FS/part_bill_event.html">part_bill_event</a> - Invoice event definitions
      <ul>
        <li>eventpart - primary key
        <li>payby - CARD, DCRD, CHEK, DCHK, LECB, BILL, or COMP
        <li>event - event name
        <li>eventcode - event action
        <li>seconds - how long after the invoice date (<a href="#cust_bill">cust_bill</a>._date) events of this type are triggered
        <li>weight - ordering for events with identical seconds
        <li>plan - eventcode plan
        <li>plandata - additional plan data
        <li>disabled - Disabled flag, empty or `Y'
        <li>taxclass - Texas tax class flag, empty or "none", "access", or "hosting"
      </ul>
    <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
      <ul>
        <li>invnum - (multiple) key
        <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
        <li>setup - setup fee 
        <li>recur - recurring fee
        <li>sdate - starting date
        <li>edate - ending date
        <li>itemdesc - Line item description (currently used only when pkgnum is 0)
      </ul>
    <li><a name="cust_bill_pkg_detail" href="man/FS/cust_bill_pkg_detail.html">cust_bill_pkg_detail</a> - Invoice line items detail
      <ul>
        <li>detailnum - primary key
        <li>pkgnum -
        <li>invnum - 
        <li>detail - Detail description
      </ul>
    <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.
      <ul>
        <li>crednum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>amount - amount credited
        <li>_date
        <li>otaker - order taker
        <li>reason
        <li>closed - books closed flag, empty or `Y'
      </ul>
    <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.
      <ul>
        <li>creditbillnum - primary key
        <li>crednum - <a href="#cust_credit">credit</a> being applied
        <li>invnum - <a href="#cust_bill">invoice</a> to which credit is applied
        <li>amount - amount applied
        <li>_date
      </ul>
    <li><a name="cust_pay_refund" href="man/FS/cust_pay_refund.html">cust_credit_bill</a> - Refund payment application.  Links a refund to a payment.
      <ul>
        <li>payrefundnum - primary key
        <li>paynum - <a href="#cust_pay">payment</a>
        <li>refundnum - <a href="#cust_refund">refund</a>
        <li>amount - amount applied
        <li>_date
      </ul>
    <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
      <ul>
        <li>custnum - primary key
        <li>agentnum - <a href="#agent">agent</a>
        <li>refnum - <a href="#part_referral">referral</a>
        <li>first - name
        <li>last - name
        <li>ss - social security number
        <li>company
        <li>address1
        <li>address2
        <li>city
        <li>county
        <li>state
        <li>zip
        <li>country
        <li>daytime - phone
        <li>night - phone
        <li>fax - phone
        <li><i>ship_first</i>
        <li><i>ship_last</i>
        <li><i>ship_company</i>
        <li><i>ship_address1</i>
        <li><i>ship_address2</i>
        <li><i>ship_city</i>
        <li><i>ship_county</i>
        <li><i>ship_state</i>
        <li><i>ship_zip</i>
        <li><i>ship_country</i>
        <li><i>ship_daytime</i>
        <li><i>ship_night</i>
        <li><i>ship_fax</i>
        <li>payby - CARD, DCHK, CHEK, DCHK, LECB, BILL, or COMP
        <li>payinfo - card number, P.O.#, or comp issuer
        <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
        <li>paydate - expiration date
        <li>payname - billing name (name on card)
        <li>tax - tax exempt, Y or null
        <li>otaker - order taker
        <li>referral_custnum
        <li>comments
      </ul>
      (columns in <i>italics</i> are optional)
    <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.
      <ul>
        <li>destnum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <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.
      </ul>
    <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
      <ul>
        <li>taxnum - primary key
        <li>state
        <li>county
        <li>country
        <li>tax - % rate
        <li>taxclass
        <li>exempt_amount
        <li>taxname - if defined, printed on invoices instead of "Tax"
        <li>setuptax - if 'Y', this tax does not apply to setup fees
        <li>recurtax - if 'Y', this tax does not apply to recurring fees
      </ul>
    <li><a name="cust_tax_exempt" href="man/FS/cust_tax_exempt.html">cust_tax_exempt</a> - Tax exemption record
      <ul>
        <li>exemptnum - primary key
        <li>taxnum - <a href="#cust_main_county">tax rate</a>
        <li>year
        <li>month
        <li>amount
      </ul>
    <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
      <ul>
        <li>paynum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>paid - amount
        <li>_date
        <li>payby - CARD, CHEK, LECB, BILL, or COMP
        <li>payinfo - card number, P.O.#, or comp issuer
        <li>paybatch - text field for tracking card processor batches
        <li>closed - books closed flag, empty or `Y'
      </ul>
    <li><a name="cust_pay-void" href="man/FS/cust_pay_void.html">cust_pay_void</a> - Voided payments.
      <ul>
        <li>paynum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>paid - amount
        <li>_date
        <li>payby - CARD, CHEK, LECB, BILL, or COMP
        <li>payinfo - card number, P.O.#, or comp issuer
        <li>paybatch - text field for tracking card processor batches
        <li>closed - books closed flag, empty or `Y'
        <li>void_date
        <li>reason
        <li>otaker - order taker
      </ul>
    <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.
      <ul>
        <li>billpaynum
        <li>invnum - <a href="#cust_bill">invoice</a>
        <li>paynum - <a href="#cust_pay">payment</a>
        <li>amount
        <li>_date
      </ul>
    <li><a name="pay_batch" href="man/FS/pay_batch.html">pay_batch</a> - Pending batch
      <ul>
        <li>batchnum
        <li>status
        <li>download
        <li>upload
      </ul>
    <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch members
      <ul>
        <li>paybatchnum
        <li>batchnum
        <li>payby - CARD, CHEK, LECB, BILL, or COMP
        <li>payinfo - account number
        <li>exp - card expiration
        <li>amount
        <li>invnum - <a href="#cust_bill">invoice</a>
        <li>custnum - <a href="#cust_main">customer</a>
        <li>payname - name on card
        <li>first - name
        <li>last - name
        <li>address1
        <li>address2
        <li>city
        <li>state
        <li>zip
        <li>country
        <li>status
      </ul>
    <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
      <ul>
        <li>pkgnum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>pkgpart - <a href="#part_pkg">Package definition</a>
        <li>setup - date
        <li>bill - next bill date
        <li>last_bill - last bill date
        <li>susp - (past) suspension date
        <li>expire - (future) cancellation date
        <li>cancel - (past) cancellation date
        <li>otaker - order taker
        <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.
      </ul>
    <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.
      <ul>
        <li>refundnum - primary key
        <li>custnum - <a href="#cust_main">customer</a>
        <li>refund - amount
        <li>_date
        <li>payby - CARD, CHEK, LECB, BILL or COMP
        <li>payinfo - card number, P.O.#, or comp issuer
        <li>otaker - order taker
        <li>closed - books closed flag, empty or `Y'
      </ul>
    <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.
      <ul>
        <li>creditrefundnum - primary key
        <li>crednum - <a href="#cust_credit">credit</a>
        <li>refundnum - <a href="#cust_refund">refund</a>
        <li>amount
        <li>_date
      </ul>
    <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
      <ul>
        <li>svcnum - primary key
        <li>pkgnum - <a href="#cust_pkg">package</a>
        <li>svcpart - <a href="#part_svc">Service definition</a>
      </ul>
    <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
      <ul>
        <li>nasnum - primary key
        <li>nas - NAS name
        <li>nasip - NAS ip address
        <li>nasfqdn - NAS fully-qualified domain name
        <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
      </ul>
    <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
      <ul>
        <li>pkgpart - primary key
        <li>pkg - package name
        <li>comment - non-customer visable package comment
        <li>promo_code - promotional code
        <li><i>deprecated</i> setup - setup fee expression
        <li>freq - recurring frequency (months)
        <li><i>deprecated</i> recur - recurring fee expression
        <li>setuptax - Setup fee tax exempt flag, empty or `Y'
        <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
        <li>plan - price plan
        <li><i>deprecated</i> plandata - additional price plan data
        <li>disabled - Disabled flag, empty or `Y'
      </ul>
    <li><a name="part_pkg_option" href="man/FS/part_pkg_option.html">part_pkg_option</a> - Package definition options
      <ul>
        <li>optionnum - primary key
        <li>pkgpart - <a href="#part_pkg">Package definition</a>
        <li>optionname - option name
        <li>optionvalue - option value
      </ul>
    <li><a name="reg_code" href="man/FS/reg_code.html">reg_code</A> - One-time registration codes
      <ul>
        <li>codenum - primary key
        <li>code
        <li>agentnum - <a href="#agent">Agent</a>
      </ul>
    <li><a name="reg_code_pkg" href="man/FS/reg_code_pkg.html">reg_code_pkg</A> - Registration code link to package definitions
      <ul>
        <li>codepkgnum - primary key
        <li>codenum - <a href="#reg_code">Registration code</a>
        <li>pkgpart - <a href="#part_pkg">Package definition</a>
      </ul>
    <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
      <ul>
        <li>refnum - primary key
        <li>referral - referral
      </ul>
    <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
      <ul>
        <li>svcpart - primary key
        <li>svc - name of this service
        <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
        <li>disabled - Disabled flag, empty or `Y'
<!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
        <li><i>table</i>__<i>field</i>_flag - null, D or F
-->
      </ul>
    <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
      <ul>
        <li>columnnum - primary key
        <li>svcpart - <a href="#part_svc">Service definition</a>
        <li>columnname - column name in part_svc.svcdb table
        <li>columnvalue - default or fixed value for the column
        <li>columnflag - null, D or F
      </ul>
    <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
      <ul>
        <li>pkgsvcnum - primary key
        <li>pkgpart - <a href="#part_pkg">Package definition</a>
        <li>svcpart - <a href="#part_svc">Service definition</a>
        <li>quantity - quantity of this service that this package includes
        <li>primary_svc - blank or Y: primary service
      </ul>
    <li><a name="export_svc" href="man/FS/export_svc.html">export_svc</a>
      <ul>
        <li>exportsvcnum - primary key
        <li>svcpart - <a href="#part_svc">Service definition</a>
        <li>exportnum - <a href="#exportnum">Export</a>
      </ul>
    <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
      <ul>
        <li>exportnum - primary key
        <li>machine - Machine name 
        <li>exporttype - Export type
        <li>nodomain - blank or Y: usernames are exported to this service with no domain
      </ul>
    <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
      <ul>
        <li>optionnum - primary key
        <li>exportnum - <a href="#part_export">Export</a>
        <li>optionname - option name
        <li>optionvalue - option value
      </ul>
    <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
      <ul>
        <li>portnum - primary key
        <li>ip - IP address of this port
        <li>nasport - port number on the NAS
        <li>nasnum - <a href="#nas">NAS</a>
      </ul>
    <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a> - prepaid cards
      <ul>
        <li>prepaynum - primary key
        <li>identifier - text or numeric string of prepaid card
        <li>amount - amount of prepayment
        <li>seconds - prepaid time instead of (or in addition to) monetary value
        <li>agentnum - optional agent assignment for prepaid cards
      </ul>
    <li><a name="session" href="man/FS/session.html">session</a>
      <ul>
        <li>sessionnum - primary key
        <li>portnum - <a href="#port">Port</a>
        <li>svcnum - <a href="#svc_acct">Account</a>
        <li>login - timestamp indicating the beginning of this user session.
        <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
      </ul>

    <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
      <ul>
        <li>svcnum - <a href="#cust_svc">primary key</a>
        <li>username
        <li>_password
        <li>sec_phrase - security phrase
        <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
        <li>uid
        <li>gid
        <li>finger - GECOS
        <li>dir
        <li>shell
        <li>quota - (unimplementd)
        <li>slipip - IP address
        <li>seconds
        <li>domsvc
        <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
        <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
      </ul>
    <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
      <ul>
        <li>popnum - primary key
        <li>city
        <li>state
        <li>ac - area code
        <li>exch - exchange
        <li>loc - rest of number
      </ul>
    <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
      <ul>
        <li>localnum - primary key
        <li>popnum - primary key
        <li>city
        <li>state
        <li>npa - area code
        <li>nxx - exchange
      </ul>
    <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
      <ul>
        <li>svcnum - <a href="#cust_svc">primary key</a>
        <li>domain
      </ul>
    <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
      <ul>
        <li>svcnum - <a href="#cust_svc">primary key</a>
        <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
        <li>src - literal source (username or full email address)
        <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
        <li>dst - literal destination (username or full email address)
      </ul>
    <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
      <ul>
        <li>recnum - primary key
        <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
        <li>reczone - zone for this line
        <li>recaf - address family, usually <b>IN</b>
        <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
        <li>recdata - data for this record
      </ul>
    <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
      <ul>
       <li>svcnum - <a href="#cust-svc">primary key</a>
       <li>recnum - <a href="#domain_record">host</a>
       <li>usersvc - <a href="#svc_acct">account</a>
      </ul>
    <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
      <ul>
        <li>typepkgnum - primary key
        <li>typenum - <a href="#agent_type">agent type</a>
        <li>pkgpart - <a href="#part_pkg">Package definition</a>
      </ul>
    <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
      <ul>
        <li>jobnum - primary key
        <li>job
        <li>_date
        <li>status
        <li>statustext
        <li>svcnum
      </ul>
    <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
      <ul>
        <li>argnum - primary key
        <li>jobnum - <a href="#queue">job</a>
        <li>arg - argument
      </ul>
    <li><a name="queue_depend" href="man/FS/queue_depend.html">queue_depend</a> - job dependancies
      <ul>
        <li>dependnum - primary key
        <li>jobnum - source jobnum
        <li>depend_jobnum - dependancy jobnum
      </ul>
    <li><a name="radius_usergroup" href="man/FS/radius_usergroup.html">radius_usergroup</a> - Link users to RADIUS groups.
      <ul>
        <li>usergroupnum - primary key
        <li>svcnum - <a href="#svc_acct">account</a>
        <li>groupname
      </ul>
    <li><a name="rate" href="man/FS/rate.html">rate</a> - Call rate plans
      <ul>
        <li>ratenum - primary key
        <li>ratename
      </ul>
    <li><a name="rate_detail" href="man/FS/rate_detail.html">rate_detail</a> - Call rate detail
      <ul>
        <li>ratedetailnum - primary key
        <li>ratenum - <a href="#rate">rate plan</a>
        <li>orig_regionnum - call origination <a href="#rate_region">region</a>
        <li>dest_regionnum - call destination <a href="#rate_region">region</a>
        <li>min_included - included minutes
        <li>min_charge - charge per minute
        <li>sec_granularity - granularity in seconds, i.e. 6 or 60
      </ul>
    <li><a name="rate_region" href="man/FS/rate_region.html">rate_region</a> - Call rate region
      <ul>
        <li>regionnum - primary key
        <li>regionname
      </ul>
    <li><a name="rate_prefix" href="man/FS/rate_prefix.html">rate_prefix</a> - Call rate prefix
      <ul>
        <li>prefixnum - primary key
        <li>regionnum - <a href="#rate_region">rate region</a>
        <li>countrycode
        <li>npa
        <li>nxx
      </ul>
    <li><a name="msgcat" href="man/FS/msgcat.html">msgcat</a> - i18n message catalog
      <ul>
        <li>msgnum - primary key
        <li>msgcode - message code
        <li>locale - locale
        <li>msg - Message text
      </ul>
    <li><a name="clientapi_session" href="man/FS/clientapi_session.html">clientapi_session</a> - ClientAPI session store
      <ul>
        <li>sessionnum - primary key
        <li>sessionid - session ID
        <li>namespace - session namespace
      </ul>
    <li><a name="clientapi_session_field" href="man/FS/clientapi_session_field.html">clientapi_session_field</a> - Client API session store data
      <ul>
        <li>fieldnum - primary key
        <li>sessionnum - <a href="#session">session</a>
        <li>fieldname
        <li>fieldvalue
      </ul>
  </ul>
</body>