3 use vars qw($base_dir @config_items @base_items @card_types $DEBUG);
10 use FS::Conf_compat17;
12 use FS::Record qw(qsearch qsearchs);
13 use FS::UID qw(dbh datasrc use_confcompat);
15 $base_dir = '%%%FREESIDE_CONF%%%';
21 FS::Conf - Freeside configuration values
29 $value = $conf->config('key');
30 @list = $conf->config('key');
31 $bool = $conf->exists('key');
34 $conf->set('key' => 'value');
37 @config_items = $conf->config_items;
41 Read and write Freeside configuration values. Keys currently map to filenames,
42 but this may change in the future.
50 Create a new configuration object.
56 my($class) = ref($proto) || $proto;
57 my($self) = { 'base_dir' => $base_dir };
58 bless ($self, $class);
63 Returns the base directory. By default this is /usr/local/etc/freeside.
69 my $base_dir = $self->{base_dir};
70 -e $base_dir or die "FATAL: $base_dir doesn't exist!";
71 -d $base_dir or die "FATAL: $base_dir isn't a directory!";
72 -r $base_dir or die "FATAL: Can't read $base_dir!";
73 -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
74 $base_dir =~ /^(.*)$/;
78 =item config KEY [ AGENTNUM ]
80 Returns the configuration value or values (depending on context) for key.
81 The optional agent number selects an agent specific value instead of the
82 global default if one is present.
87 my ($self, $method) = (shift, shift);
88 carp "NO CONFIGURATION RECORDS FOUND -- USING COMPATIBILITY MODE"
90 my $compat = new FS::Conf_compat17 ("$base_dir/conf." . datasrc);
95 my($self,$name,$agentnum)=@_;
96 my $hashref = { 'name' => $name };
97 $hashref->{agentnum} = $agentnum;
98 local $FS::Record::conf = undef; # XXX evil hack prevents recursion
99 my $cv = FS::Record::qsearchs('conf', $hashref);
100 if (!$cv && defined($agentnum)) {
101 $hashref->{agentnum} = '';
102 $cv = FS::Record::qsearchs('conf', $hashref);
109 return $self->_usecompat('config', @_) if use_confcompat;
111 my($name,$agentnum)=@_;
112 my $cv = $self->_config($name, $agentnum) or return;
117 (split "\n", $v, -1);
119 (split("\n", $cv->value))[0];
123 =item config_binary KEY [ AGENTNUM ]
125 Returns the exact scalar value for key.
131 return $self->_usecompat('config_binary', @_) if use_confcompat;
133 my($name,$agentnum)=@_;
134 my $cv = $self->_config($name, $agentnum) or return;
135 decode_base64($cv->value);
138 =item exists KEY [ AGENTNUM ]
140 Returns true if the specified key exists, even if the corresponding value
147 return $self->_usecompat('exists', @_) if use_confcompat;
149 my($name,$agentnum)=@_;
150 defined($self->_config($name, $agentnum));
153 =item config_orbase KEY SUFFIX
155 Returns the configuration value or values (depending on context) for
156 KEY_SUFFIX, if it exists, otherwise for KEY
160 # outmoded as soon as we shift to agentnum based config values
161 # well, mostly. still useful for e.g. late notices, etc. in that we want
162 # these to fall back to standard values
165 return $self->_usecompat('config_orbase', @_) if use_confcompat;
167 my( $name, $suffix ) = @_;
168 if ( $self->exists("${name}_$suffix") ) {
169 $self->config("${name}_$suffix");
171 $self->config($name);
175 =item key_orbase KEY SUFFIX
177 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
178 KEY. Useful for determining which exact configuration option is returned by
185 #no compat for this...return $self->_usecompat('config_orbase', @_) if use_confcompat;
187 my( $name, $suffix ) = @_;
188 if ( $self->exists("${name}_$suffix") ) {
195 =item invoice_templatenames
197 Returns all possible invoice template names.
201 sub invoice_templatenames {
204 my %templatenames = ();
205 foreach my $item ( $self->config_items ) {
206 foreach my $base ( @base_items ) {
207 my( $main, $ext) = split(/\./, $base);
208 $ext = ".$ext" if $ext;
209 if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
210 $templatenames{$1}++;
215 sort keys %templatenames;
219 =item touch KEY [ AGENT ];
221 Creates the specified configuration key if it does not exist.
227 return $self->_usecompat('touch', @_) if use_confcompat;
229 my($name, $agentnum) = @_;
230 unless ( $self->exists($name, $agentnum) ) {
231 $self->set($name, '', $agentnum);
235 =item set KEY VALUE [ AGENTNUM ];
237 Sets the specified configuration key to the given value.
243 return $self->_usecompat('set', @_) if use_confcompat;
245 my($name, $value, $agentnum) = @_;
249 warn "[FS::Conf] SET $name\n" if $DEBUG;
251 my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
252 my $new = new FS::conf { $old ? $old->hash
253 : ('name' => $name, 'agentnum' => $agentnum)
259 $error = $new->replace($old);
261 $error = $new->insert;
264 die "error setting configuration value: $error \n"
269 =item set_binary KEY VALUE [ AGENTNUM ]
271 Sets the specified configuration key to an exact scalar value which
272 can be retrieved with config_binary.
278 return if use_confcompat;
280 my($name, $value, $agentnum)=@_;
281 $self->set($name, encode_base64($value), $agentnum);
284 =item delete KEY [ AGENTNUM ];
286 Deletes the specified configuration key.
292 return $self->_usecompat('delete', @_) if use_confcompat;
294 my($name, $agentnum) = @_;
295 if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
296 warn "[FS::Conf] DELETE $name\n";
298 my $oldAutoCommit = $FS::UID::AutoCommit;
299 local $FS::UID::AutoCommit = 0;
302 my $error = $cv->delete;
305 $dbh->rollback if $oldAutoCommit;
306 die "error setting configuration value: $error \n"
309 $dbh->commit or die $dbh->errstr if $oldAutoCommit;
314 =item import_config_item CONFITEM DIR
316 Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
317 the database as a conf record (see L<FS::conf>). Imports from the file
318 in the directory DIR.
322 sub import_config_item {
323 my ($self,$item,$dir) = @_;
324 my $key = $item->key;
325 if ( -e "$dir/$key" && ! use_confcompat ) {
326 warn "Inserting $key\n" if $DEBUG;
328 my $value = readline(new IO::File "$dir/$key");
329 if ($item->type eq 'binary') {
330 $self->set_binary($key, $value);
332 $self->set($key, $value);
335 warn "Not inserting $key\n" if $DEBUG;
339 =item verify_config_item CONFITEM DIR
341 Compares the item specified by the CONFITEM (see L<FS::ConfItem>) in
342 the database to the legacy file value in DIR.
346 sub verify_config_item {
347 return '' if use_confcompat;
348 my ($self,$item,$dir) = @_;
349 my $key = $item->key;
350 my $type = $item->type;
352 my $compat = new FS::Conf_compat17 $dir;
355 $error .= "$key fails existential comparison; "
356 if $self->exists($key) xor $compat->exists($key);
358 unless ($type eq 'binary') {
361 $error .= "$key fails scalar comparison; "
362 unless scalar($self->config($key)) eq scalar($compat->config($key));
365 my (@new) = $self->config($key);
366 my (@old) = $compat->config($key);
367 unless ( scalar(@new) == scalar(@old)) {
368 $error .= "$key fails list comparison; ";
371 foreach (@old) { $r=0 if ($_ cmp shift(@new)); }
372 $error .= "$key fails list comparison; "
377 if ($type eq 'binary') {
378 $error .= "$key fails binary comparison; "
379 unless scalar($self->config_binary($key)) eq scalar($compat->config_binary($key));
382 if ($error =~ /existential comparison/ && $item->section eq 'deprecated') {
384 for ( @config_items ) { $proto = $_; last if $proto->key eq $key; }
385 unless ($proto->key eq $key) {
386 warn "removed config item $error\n" if $DEBUG;
394 #item _orbase_items OPTIONS
396 #Returns all of the possible extensible config items as FS::ConfItem objects.
397 #See #L<FS::ConfItem>. OPTIONS consists of name value pairs. Possible
400 # dir - the directory to search for configuration option files instead
401 # of using the conf records in the database
407 my ($self, %opt) = @_;
409 my $listmaker = sub { my $v = shift;
411 if ( $v =~ /\.(png|eps)$/ ) {
417 FS::Record::qsearch( 'conf',
420 "WHERE name LIKE '$v' ESCAPE '!'"
424 if (exists($opt{dir}) && $opt{dir}) {
425 $listmaker = sub { my $v = shift;
426 if ( $v =~ /\.(png|eps)$/ ) {
431 map { basename $_ } glob($opt{dir}. "/$v" );
438 for ( @config_items ) { $proto = $_; last if $proto->key eq $base; }
439 die "don't know about $base items" unless $proto->key eq $base;
441 map { new FS::ConfItem {
443 'section' => $proto->section,
444 'description' => 'Alternate ' . $proto->description . ' See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
445 'type' => $proto->type,
447 } &$listmaker($base);
454 Returns all of the possible global/default configuration items as
455 FS::ConfItem objects. See L<FS::ConfItem>.
461 return $self->_usecompat('config_items', @_) if use_confcompat;
463 ( @config_items, $self->_orbase_items(@_) );
472 =item init-config DIR
474 Imports the non-deprecated configuration items from DIR (1.7 compatible)
475 to conf records in the database.
483 local $FS::UID::use_confcompat = 0;
484 my $conf = new FS::Conf;
485 foreach my $item ( $conf->config_items(dir => $dir) ) {
486 $conf->import_config_item($item, $dir);
487 my $error = $conf->verify_config_item($item, $dir);
488 return $error if $error;
491 my $compat = new FS::Conf_compat17 $dir;
492 foreach my $item ( $compat->config_items ) {
493 my $error = $conf->verify_config_item($item, $dir);
494 return $error if $error;
498 $FS::UID::use_confcompat = 0;
506 If this was more than just crud that will never be useful outside Freeside I'd
507 worry that config_items is freeside-specific and icky.
511 "Configuration" in the web interface (config/config.cgi).
515 #Business::CreditCard
520 "American Express card",
521 "Diner's Club/Carte Blanche",
532 invoice_latexreturnaddress
534 invoice_latexsmallfooter
538 invoice_htmlreturnaddress
545 @config_items = map { new FS::ConfItem $_ } (
549 'section' => 'deprecated',
550 'description' => 'This configuration option is no longer used. See <a href="#invoice_template">invoice_template</a> instead.',
555 'key' => 'alerter_template',
556 'section' => 'billing',
557 'description' => 'Template file for billing method expiration alerts. See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
558 'type' => 'textarea',
563 'section' => 'deprecated',
564 'description' => '<b>DEPRECATED</b>, add an <i>apache</i> <a href="../browse/part_export.cgi">export</a> instead. Used to be the current IP address to assign to new virtual hosts',
569 'key' => 'encryption',
570 'section' => 'billing',
571 'description' => 'Enable encryption of credit cards.',
572 'type' => 'checkbox',
576 'key' => 'encryptionmodule',
577 'section' => 'billing',
578 'description' => 'Use which module for encryption?',
583 'key' => 'encryptionpublickey',
584 'section' => 'billing',
585 'description' => 'Your RSA Public Key - Required if Encryption is turned on.',
586 'type' => 'textarea',
590 'key' => 'encryptionprivatekey',
591 'section' => 'billing',
592 'description' => 'Your RSA Private Key - Including this will enable the "Bill Now" feature. However if the system is compromised, a hacker can use this key to decode the stored credit card information. This is generally not a good idea.',
593 'type' => 'textarea',
597 'key' => 'business-onlinepayment',
598 'section' => 'billing',
599 'description' => '<a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support, at least three lines: processor, login, and password. An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\'). Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
600 'type' => 'textarea',
604 'key' => 'business-onlinepayment-ach',
605 'section' => 'billing',
606 'description' => 'Alternate <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> support for ACH transactions (defaults to regular <b>business-onlinepayment</b>). At least three lines: processor, login, and password. An optional fourth line specifies the action or actions (multiple actions are separated with `,\': for example: `Authorization Only, Post Authorization\'). Optional additional lines are passed to Business::OnlinePayment as %processor_options.',
607 'type' => 'textarea',
611 'key' => 'business-onlinepayment-description',
612 'section' => 'billing',
613 'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>. Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply)',
618 'key' => 'business-onlinepayment-email-override',
619 'section' => 'billing',
620 'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
625 'key' => 'business-onlinepayment-email_customer',
626 'section' => 'billing',
627 'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
628 'type' => 'checkbox',
632 'key' => 'countrydefault',
634 'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
639 'key' => 'date_format',
641 'description' => 'Format for displaying dates',
644 '%m/%d/%Y' => 'MM/DD/YYYY',
645 '%Y/%m/%d' => 'YYYY/MM/DD',
650 'key' => 'deletecustomers',
652 'description' => 'Enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers\' packages if they cancel service.',
653 'type' => 'checkbox',
657 'key' => 'deletepayments',
658 'section' => 'billing',
659 'description' => 'Enable deletion of unclosed payments. Really, with voids this is pretty much not recommended in any situation anymore. Be very careful! Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.',
660 'type' => [qw( checkbox text )],
664 'key' => 'deletecredits',
665 'section' => 'deprecated',
666 'description' => '<B>DEPRECATED</B>, now controlled by ACLs. Used to enable deletion of unclosed credits. Be very careful! Only delete credits that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted.',
667 'type' => [qw( checkbox text )],
671 'key' => 'deleterefunds',
672 'section' => 'billing',
673 'description' => 'Enable deletion of unclosed refunds. Be very careful! Only delete refunds that were data-entry errors, not adjustments.',
674 'type' => 'checkbox',
679 'section' => 'shell',
680 'description' => 'Optional numeric value to control directory hashing. If positive, hashes directories for the specified number of levels from the front of the username. If negative, hashes directories for the specified number of levels from the end of the username. Some examples: <ul><li>1: user -> <a href="#home">/home</a>/u/user<li>2: user -> <a href="#home">/home</a>/u/s/user<li>-1: user -> <a href="#home">/home</a>/r/user<li>-2: user -> <a href="#home">home</a>/r/e/user</ul>',
685 'key' => 'disable_customer_referrals',
687 'description' => 'Disable new customer-to-customer referrals in the web interface',
688 'type' => 'checkbox',
692 'key' => 'editreferrals',
694 'description' => 'Enable advertising source modification for existing customers',
695 'type' => 'checkbox',
699 'key' => 'emailinvoiceonly',
700 'section' => 'billing',
701 'description' => 'Disables postal mail invoices',
702 'type' => 'checkbox',
706 'key' => 'disablepostalinvoicedefault',
707 'section' => 'billing',
708 'description' => 'Disables postal mail invoices as the default option in the UI. Be careful not to setup customers which are not sent invoices. See <a href ="#emailinvoiceauto">emailinvoiceauto</a>.',
709 'type' => 'checkbox',
713 'key' => 'emailinvoiceauto',
714 'section' => 'billing',
715 'description' => 'Automatically adds new accounts to the email invoice list',
716 'type' => 'checkbox',
720 'key' => 'emailinvoiceautoalways',
721 'section' => 'billing',
722 'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
723 'type' => 'checkbox',
727 'key' => 'exclude_ip_addr',
729 'description' => 'Exclude these from the list of available broadband service IP addresses. (One per line)',
730 'type' => 'textarea',
734 'key' => 'auto_router',
736 'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
737 'type' => 'checkbox',
741 'key' => 'hidecancelledpackages',
743 'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
744 'type' => 'checkbox',
748 'key' => 'hidecancelledcustomers',
750 'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
751 'type' => 'checkbox',
756 'section' => 'shell',
757 'description' => 'For new users, prefixed to username to create a directory name. Should have a leading but not a trailing slash.',
762 'key' => 'invoice_from',
763 'section' => 'required',
764 'description' => 'Return address on email invoices',
769 'key' => 'invoice_template',
770 'section' => 'billing',
771 'description' => 'Text template file for invoices. Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients. See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
772 'type' => 'textarea',
776 'key' => 'invoice_html',
777 'section' => 'billing',
778 'description' => 'Optional HTML template for invoices. See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
780 'type' => 'textarea',
784 'key' => 'invoice_htmlnotes',
785 'section' => 'billing',
786 'description' => 'Notes section for HTML invoices. Defaults to the same data in invoice_latexnotes if not specified.',
787 'type' => 'textarea',
791 'key' => 'invoice_htmlfooter',
792 'section' => 'billing',
793 'description' => 'Footer for HTML invoices. Defaults to the same data in invoice_latexfooter if not specified.',
794 'type' => 'textarea',
798 'key' => 'invoice_htmlreturnaddress',
799 'section' => 'billing',
800 'description' => 'Return address for HTML invoices. Defaults to the same data in invoice_latexreturnaddress if not specified.',
801 'type' => 'textarea',
805 'key' => 'invoice_latex',
806 'section' => 'billing',
807 'description' => 'Optional LaTeX template for typeset PostScript invoices. See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
808 'type' => 'textarea',
812 'key' => 'invoice_latexnotes',
813 'section' => 'billing',
814 'description' => 'Notes section for LaTeX typeset PostScript invoices.',
815 'type' => 'textarea',
819 'key' => 'invoice_latexfooter',
820 'section' => 'billing',
821 'description' => 'Footer for LaTeX typeset PostScript invoices.',
822 'type' => 'textarea',
826 'key' => 'invoice_latexcoupon',
827 'section' => 'billing',
828 'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
829 'type' => 'textarea',
833 'key' => 'invoice_latexreturnaddress',
834 'section' => 'billing',
835 'description' => 'Return address for LaTeX typeset PostScript invoices.',
836 'type' => 'textarea',
840 'key' => 'invoice_latexsmallfooter',
841 'section' => 'billing',
842 'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
843 'type' => 'textarea',
847 'key' => 'invoice_email_pdf',
848 'section' => 'billing',
849 'description' => 'Send PDF invoice as an attachment to emailed invoices. By default, includes the plain text invoice as the email body, unless invoice_email_pdf_note is set.',
854 'key' => 'invoice_email_pdf_note',
855 'section' => 'billing',
856 'description' => 'If defined, this text will replace the default plain text invoice as the body of emailed PDF invoices.',
862 'key' => 'invoice_default_terms',
863 'section' => 'billing',
864 'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.',
866 'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 20', 'Net 30', 'Net 45', 'Net 60' ],
870 'key' => 'invoice_sections',
871 'section' => 'billing',
872 'description' => 'Split invoice into sections and label according to package class when enabled.',
873 'type' => 'checkbox',
877 'key' => 'separate_usage',
878 'section' => 'billing',
879 'description' => 'Split the rated call usage into a separate line from the recurring charges.',
880 'type' => 'checkbox',
884 'key' => 'payment_receipt_email',
885 'section' => 'billing',
886 'description' => 'Template file for payment receipts. Payment receipts are sent to the customer email invoice destination(s) when a payment is received. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language. The following variables are available: <ul><li><code>$date</code> <li><code>$name</code> <li><code>$paynum</code> - Freeside payment number <li><code>$paid</code> - Amount of payment <li><code>$payby</code> - Payment type (Card, Check, Electronic check, etc.) <li><code>$payinfo</code> - Masked credit card number or check number <li><code>$balance</code> - New balance</ul>',
887 'type' => [qw( checkbox textarea )],
892 'section' => 'required',
893 'description' => 'Print command for paper invoices, for example `lpr -h\'',
898 'key' => 'lpr-postscript_prefix',
899 'section' => 'billing',
900 'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
905 'key' => 'lpr-postscript_suffix',
906 'section' => 'billing',
907 'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
912 'key' => 'money_char',
914 'description' => 'Currency symbol - defaults to `$\'',
919 'key' => 'defaultrecords',
921 'description' => 'DNS entries to add automatically when creating a domain',
922 'type' => 'editlist',
923 'editlist_parts' => [ { type=>'text' },
924 { type=>'immutable', value=>'IN' },
926 select_enum=>{ map { $_=>$_ } qw(A CNAME MX NS TXT)} },
927 { type=> 'text' }, ],
931 'key' => 'passwordmin',
932 'section' => 'password',
933 'description' => 'Minimum password length (default 6)',
938 'key' => 'passwordmax',
939 'section' => 'password',
940 'description' => 'Maximum password length (default 8) (don\'t set this over 12 if you need to import or export crypt() passwords)',
945 'key' => 'password-noampersand',
946 'section' => 'password',
947 'description' => 'Disallow ampersands in passwords',
948 'type' => 'checkbox',
952 'key' => 'password-noexclamation',
953 'section' => 'password',
954 'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
955 'type' => 'checkbox',
959 'key' => 'referraldefault',
961 'description' => 'Default referral, specified by refnum',
966 # 'key' => 'registries',
967 # 'section' => 'required',
968 # 'description' => 'Directory which contains domain registry information. Each registry is a directory.',
972 'key' => 'maxsearchrecordsperpage',
974 'description' => 'If set, number of search records to return per page.',
979 'key' => 'session-start',
980 'section' => 'session',
981 'description' => 'If defined, the command which is executed on the Freeside machine when a session begins. The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
986 'key' => 'session-stop',
987 'section' => 'session',
988 'description' => 'If defined, the command which is executed on the Freeside machine when a session ends. The contents of the file are treated as a double-quoted perl string, with the following variables available: <code>$ip</code>, <code>$nasip</code> and <code>$nasfqdn</code>, which are the IP address of the starting session, and the IP address and fully-qualified domain name of the NAS this session is on.',
994 'section' => 'shell',
995 'description' => 'Legal shells (think /etc/shells). You probably want to `cut -d: -f7 /etc/passwd | sort | uniq\' initially so that importing doesn\'t fail with `Illegal shell\' errors, then remove any special entries afterwords. A blank line specifies that an empty shell is permitted.',
996 'type' => 'textarea',
1000 'key' => 'showpasswords',
1002 'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1003 'type' => 'checkbox',
1007 'key' => 'signupurl',
1009 'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to the signup server with the appropriate customer as referral',
1014 'key' => 'smtpmachine',
1015 'section' => 'required',
1016 'description' => 'SMTP relay for Freeside\'s outgoing mail',
1021 'key' => 'soadefaultttl',
1022 'section' => 'BIND',
1023 'description' => 'SOA default TTL for new domains.',
1028 'key' => 'soaemail',
1029 'section' => 'BIND',
1030 'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1035 'key' => 'soaexpire',
1036 'section' => 'BIND',
1037 'description' => 'SOA expire for new domains',
1042 'key' => 'soamachine',
1043 'section' => 'BIND',
1044 'description' => 'SOA machine for new domains, with trailing `.\'',
1049 'key' => 'soarefresh',
1050 'section' => 'BIND',
1051 'description' => 'SOA refresh for new domains',
1056 'key' => 'soaretry',
1057 'section' => 'BIND',
1058 'description' => 'SOA retry for new domains',
1063 'key' => 'statedefault',
1065 'description' => 'Default state or province (if not supplied, the default is `CA\')',
1070 'key' => 'unsuspendauto',
1071 'section' => 'billing',
1072 'description' => 'Enables the automatic unsuspension of suspended packages when a customer\'s balance due changes from positive to zero or negative as the result of a payment or credit',
1073 'type' => 'checkbox',
1077 'key' => 'unsuspend-always_adjust_next_bill_date',
1078 'section' => 'billing',
1079 'description' => 'Global override that causes unsuspensions to always adjust the next bill date under any circumstances. This is now controlled on a per-package bases - probably best not to use this option unless you are a legacy installation that requires this behaviour.',
1080 'type' => 'checkbox',
1084 'key' => 'usernamemin',
1085 'section' => 'username',
1086 'description' => 'Minimum username length (default 2)',
1091 'key' => 'usernamemax',
1092 'section' => 'username',
1093 'description' => 'Maximum username length',
1098 'key' => 'username-ampersand',
1099 'section' => 'username',
1100 'description' => 'Allow the ampersand character (&) in usernames. Be careful when using this option in conjunction with <a href="../browse/part_export.cgi">exports</a> which execute shell commands, as the ampersand will be interpreted by the shell if not quoted.',
1101 'type' => 'checkbox',
1105 'key' => 'username-letter',
1106 'section' => 'username',
1107 'description' => 'Usernames must contain at least one letter',
1108 'type' => 'checkbox',
1112 'key' => 'username-letterfirst',
1113 'section' => 'username',
1114 'description' => 'Usernames must start with a letter',
1115 'type' => 'checkbox',
1119 'key' => 'username-noperiod',
1120 'section' => 'username',
1121 'description' => 'Disallow periods in usernames',
1122 'type' => 'checkbox',
1126 'key' => 'username-nounderscore',
1127 'section' => 'username',
1128 'description' => 'Disallow underscores in usernames',
1129 'type' => 'checkbox',
1133 'key' => 'username-nodash',
1134 'section' => 'username',
1135 'description' => 'Disallow dashes in usernames',
1136 'type' => 'checkbox',
1140 'key' => 'username-uppercase',
1141 'section' => 'username',
1142 'description' => 'Allow uppercase characters in usernames. Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
1143 'type' => 'checkbox',
1147 'key' => 'username-percent',
1148 'section' => 'username',
1149 'description' => 'Allow the percent character (%) in usernames.',
1150 'type' => 'checkbox',
1154 'key' => 'safe-part_bill_event',
1156 'description' => 'Validates invoice event expressions against a preset list. Useful for webdemos, annoying to powerusers.',
1157 'type' => 'checkbox',
1163 'description' => 'Turns on display/collection of social security numbers in the web interface. Sometimes required by electronic check (ACH) processors.',
1164 'type' => 'checkbox',
1168 'key' => 'show_stateid',
1170 'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface. Sometimes required by electronic check (ACH) processors.",
1171 'type' => 'checkbox',
1175 'key' => 'show_bankstate',
1177 'description' => "Turns on display/collection of state for bank accounts in the web interface. Sometimes required by electronic check (ACH) processors.",
1178 'type' => 'checkbox',
1182 'key' => 'agent_defaultpkg',
1184 'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
1185 'type' => 'checkbox',
1189 'key' => 'legacy_link',
1191 'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
1192 'type' => 'checkbox',
1196 'key' => 'legacy_link-steal',
1198 'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
1199 'type' => 'checkbox',
1203 'key' => 'queue_dangerous_controls',
1205 'description' => 'Enable queue modification controls on account pages and for new jobs. Unless you are a developer working on new export code, you should probably leave this off to avoid causing provisioning problems.',
1206 'type' => 'checkbox',
1210 'key' => 'security_phrase',
1211 'section' => 'password',
1212 'description' => 'Enable the tracking of a "security phrase" with each account. Not recommended, as it is vulnerable to social engineering.',
1213 'type' => 'checkbox',
1219 'description' => 'Message locale',
1221 'select_enum' => [ qw(en_US) ],
1225 'key' => 'signup_server-payby',
1227 'description' => 'Acceptable payment types for the signup server',
1228 'type' => 'selectmultiple',
1229 'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY BILL COMP) ],
1233 'key' => 'signup_server-default_agentnum',
1235 'description' => 'Default agent for the signup server',
1236 'type' => 'select-sub',
1237 'options_sub' => sub { require FS::Record;
1239 map { $_->agentnum => $_->agent }
1240 FS::Record::qsearch('agent', { disabled=>'' } );
1242 'option_sub' => sub { require FS::Record;
1244 my $agent = FS::Record::qsearchs(
1245 'agent', { 'agentnum'=>shift }
1247 $agent ? $agent->agent : '';
1252 'key' => 'signup_server-default_refnum',
1254 'description' => 'Default advertising source for the signup server',
1255 'type' => 'select-sub',
1256 'options_sub' => sub { require FS::Record;
1257 require FS::part_referral;
1258 map { $_->refnum => $_->referral }
1259 FS::Record::qsearch( 'part_referral',
1260 { 'disabled' => '' }
1263 'option_sub' => sub { require FS::Record;
1264 require FS::part_referral;
1265 my $part_referral = FS::Record::qsearchs(
1266 'part_referral', { 'refnum'=>shift } );
1267 $part_referral ? $part_referral->referral : '';
1272 'key' => 'signup_server-default_pkgpart',
1274 'description' => 'Default package for the signup server',
1275 'type' => 'select-sub',
1276 'options_sub' => sub { require FS::Record;
1277 require FS::part_pkg;
1278 map { $_->pkgpart => $_->pkg.' - '.$_->comment }
1279 FS::Record::qsearch( 'part_pkg',
1283 'option_sub' => sub { require FS::Record;
1284 require FS::part_pkg;
1285 my $part_pkg = FS::Record::qsearchs(
1286 'part_pkg', { 'pkgpart'=>shift }
1289 ? $part_pkg->pkg.' - '.$part_pkg->comment
1295 'key' => 'signup_server-default_svcpart',
1297 'description' => 'Default svcpart for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).',
1298 'type' => 'select-sub',
1299 'options_sub' => sub { require FS::Record;
1300 require FS::part_svc;
1301 map { $_->svcpart => $_->svc }
1302 FS::Record::qsearch( 'part_svc',
1306 'option_sub' => sub { require FS::Record;
1307 require FS::part_svc;
1308 my $part_svc = FS::Record::qsearchs(
1309 'part_svc', { 'svcpart'=>shift }
1311 $part_svc ? $part_svc->svc : '';
1316 'key' => 'signup_server-service',
1318 'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
1321 'svc_acct' => 'Account (svc_acct)',
1322 'svc_phone' => 'Phone number (svc_phone)',
1327 'key' => 'selfservice_server-base_url',
1329 'description' => 'Base URL for the self-service web interface - necessary for special provisioning widgets to find their way.',
1334 'key' => 'show-msgcat-codes',
1336 'description' => 'Show msgcat codes in error messages. Turn this option on before reporting errors to the mailing list.',
1337 'type' => 'checkbox',
1341 'key' => 'signup_server-realtime',
1343 'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
1344 'type' => 'checkbox',
1347 'key' => 'signup_server-classnum2',
1349 'description' => 'Package Class for first optional purchase',
1350 'type' => 'select-sub',
1351 'options_sub' => sub { require FS::Record;
1352 require FS::pkg_class;
1353 map { $_->classnum => $_->classname }
1354 FS::Record::qsearch('pkg_class', {} );
1356 'option_sub' => sub { require FS::Record;
1357 require FS::pkg_class;
1358 my $pkg_class = FS::Record::qsearchs(
1359 'pkg_class', { 'classnum'=>shift }
1361 $pkg_class ? $pkg_class->classname : '';
1366 'key' => 'signup_server-classnum3',
1368 'description' => 'Package Class for second optional purchase',
1369 'type' => 'select-sub',
1370 'options_sub' => sub { require FS::Record;
1371 require FS::pkg_class;
1372 map { $_->classnum => $_->classname }
1373 FS::Record::qsearch('pkg_class', {} );
1375 'option_sub' => sub { require FS::Record;
1376 require FS::pkg_class;
1377 my $pkg_class = FS::Record::qsearchs(
1378 'pkg_class', { 'classnum'=>shift }
1380 $pkg_class ? $pkg_class->classname : '';
1385 'key' => 'backend-realtime',
1387 'description' => 'Run billing for backend signups immediately.',
1388 'type' => 'checkbox',
1392 'key' => 'declinetemplate',
1393 'section' => 'billing',
1394 'description' => 'Template file for credit card decline emails.',
1395 'type' => 'textarea',
1399 'key' => 'emaildecline',
1400 'section' => 'billing',
1401 'description' => 'Enable emailing of credit card decline notices.',
1402 'type' => 'checkbox',
1406 'key' => 'emaildecline-exclude',
1407 'section' => 'billing',
1408 'description' => 'List of error messages that should not trigger email decline notices, one per line.',
1409 'type' => 'textarea',
1413 'key' => 'cancelmessage',
1414 'section' => 'billing',
1415 'description' => 'Template file for cancellation emails.',
1416 'type' => 'textarea',
1420 'key' => 'cancelsubject',
1421 'section' => 'billing',
1422 'description' => 'Subject line for cancellation emails.',
1427 'key' => 'emailcancel',
1428 'section' => 'billing',
1429 'description' => 'Enable emailing of cancellation notices. Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
1430 'type' => 'checkbox',
1434 'key' => 'require_cardname',
1435 'section' => 'billing',
1436 'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
1437 'type' => 'checkbox',
1441 'key' => 'enable_taxclasses',
1442 'section' => 'billing',
1443 'description' => 'Enable per-package tax classes',
1444 'type' => 'checkbox',
1448 'key' => 'require_taxclasses',
1449 'section' => 'billing',
1450 'description' => 'Require a taxclass to be entered for every package',
1451 'type' => 'checkbox',
1455 'key' => 'enable_taxproducts',
1456 'section' => 'billing',
1457 'description' => 'Enable per-package mapping to new style tax classes',
1458 'type' => 'checkbox',
1462 'key' => 'welcome_email',
1464 'description' => 'Template file for welcome email. Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language. The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
1465 'type' => 'textarea',
1470 'key' => 'welcome_email-from',
1472 'description' => 'From: address header for welcome email',
1478 'key' => 'welcome_email-subject',
1480 'description' => 'Subject: header for welcome email',
1486 'key' => 'welcome_email-mimetype',
1488 'description' => 'MIME type for welcome email',
1490 'select_enum' => [ 'text/plain', 'text/html' ],
1495 'key' => 'welcome_letter',
1497 'description' => 'Optional LaTex template file for a printed welcome letter. A welcome letter is printed the first time a cust_pkg record is created. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation and the billing documentation for details on the template substitution language. A variable exists for each fieldname in the customer record (<code>$first, $last, etc</code>). The following additional variables are available<ul><li><code>$payby</code> - a friendler represenation of the field<li><code>$payinfo</code> - the masked payment information<li><code>$expdate</code> - the time at which the payment method expires (a UNIX timestamp)<li><code>$returnaddress</code> - the invoice return address for this customer\'s agent</ul>',
1498 'type' => 'textarea',
1502 'key' => 'warning_email',
1504 'description' => 'Template file for warning email. Warning emails are sent to the customer email invoice destination(s) each time a svc_acct record has its usage drop below a threshold or 0. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language. The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code> <li><code>$column</code> <li><code>$amount</code> <li><code>$threshold</code></ul>',
1505 'type' => 'textarea',
1509 'key' => 'warning_email-from',
1511 'description' => 'From: address header for warning email',
1516 'key' => 'warning_email-cc',
1518 'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
1523 'key' => 'warning_email-subject',
1525 'description' => 'Subject: header for warning email',
1530 'key' => 'warning_email-mimetype',
1532 'description' => 'MIME type for warning email',
1534 'select_enum' => [ 'text/plain', 'text/html' ],
1539 'section' => 'billing',
1540 'description' => 'Available payment types.',
1541 'type' => 'selectmultiple',
1542 'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP) ],
1546 'key' => 'payby-default',
1548 'description' => 'Default payment type. HIDE disables display of billing information and sets customers to BILL.',
1550 'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD COMP HIDE) ],
1554 'key' => 'paymentforcedtobatch',
1555 'section' => 'deprecated',
1556 'description' => 'See batch-enable_payby and realtime-disable_payby. Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.',
1557 'type' => 'checkbox',
1561 'key' => 'svc_acct-notes',
1563 'description' => 'Extra HTML to be displayed on the Account View screen.',
1564 'type' => 'textarea',
1568 'key' => 'radius-password',
1570 'description' => 'RADIUS attribute for plain-text passwords.',
1572 'select_enum' => [ 'Password', 'User-Password' ],
1576 'key' => 'radius-ip',
1578 'description' => 'RADIUS attribute for IP addresses.',
1580 'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
1584 'key' => 'svc_acct-alldomains',
1586 'description' => 'Allow accounts to select any domain in the database. Normally accounts can only select from the domain set in the service definition and those purchased by the customer.',
1587 'type' => 'checkbox',
1591 'key' => 'dump-scpdest',
1593 'description' => 'destination for scp database dumps: user@host:/path',
1598 'key' => 'dump-pgpid',
1600 'description' => "Optional PGP public key user or key id for database dumps. The public key should exist on the freeside user's public keyring, and the gpg binary and GnuPG perl module should be installed.",
1605 'key' => 'cvv-save',
1606 'section' => 'billing',
1607 'description' => 'Save CVV2 information after the initial transaction for the selected credit card types. Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option for any credit card types.',
1608 'type' => 'selectmultiple',
1609 'select_enum' => \@card_types,
1613 'key' => 'allow_negative_charges',
1614 'section' => 'billing',
1615 'description' => 'Allow negative charges. Normally not used unless importing data from a legacy system that requires this.',
1616 'type' => 'checkbox',
1619 'key' => 'auto_unset_catchall',
1621 'description' => 'When canceling a svc_acct that is the email catchall for one or more svc_domains, automatically set their catchall fields to null. If this option is not set, the attempt will simply fail.',
1622 'type' => 'checkbox',
1626 'key' => 'system_usernames',
1627 'section' => 'username',
1628 'description' => 'A list of system usernames that cannot be edited or removed, one per line. Use a bare username to prohibit modification/deletion of the username in any domain, or username@domain to prohibit modification/deletetion of a specific username and domain.',
1629 'type' => 'textarea',
1633 'key' => 'cust_pkg-change_svcpart',
1635 'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
1636 'type' => 'checkbox',
1640 'key' => 'disable_autoreverse',
1641 'section' => 'BIND',
1642 'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
1643 'type' => 'checkbox',
1647 'key' => 'svc_www-enable_subdomains',
1649 'description' => 'Enable selection of specific subdomains for virtual host creation.',
1650 'type' => 'checkbox',
1654 'key' => 'svc_www-usersvc_svcpart',
1656 'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
1657 'type' => 'textarea',
1661 'key' => 'selfservice_server-primary_only',
1663 'description' => 'Only allow primary accounts to access self-service functionality.',
1664 'type' => 'checkbox',
1668 'key' => 'selfservice_server-phone_login',
1670 'description' => 'Allow login to self-service with phone number and PIN.',
1671 'type' => 'checkbox',
1675 'key' => 'selfservice_server-single_domain',
1677 'description' => 'If specified, only use this one domain for self-service access.',
1682 'key' => 'card_refund-days',
1683 'section' => 'billing',
1684 'description' => 'After a payment, the number of days a refund link will be available for that payment. Defaults to 120.',
1689 'key' => 'agent-showpasswords',
1691 'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
1692 'type' => 'checkbox',
1696 'key' => 'global_unique-username',
1697 'section' => 'username',
1698 'description' => 'Global username uniqueness control: none (usual setting - check uniqueness per exports), username (all usernames are globally unique, regardless of domain or exports), or username@domain (all username@domain pairs are globally unique, regardless of exports). disabled turns off duplicate checking completely and is STRONGLY NOT RECOMMENDED unless you REALLY need to turn this off.',
1700 'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
1704 'key' => 'svc_external-skip_manual',
1706 'description' => 'When provisioning svc_external services, skip manual entry of id and title fields in the UI. Usually used in conjunction with an export that populates these fields (i.e. artera_turbo).',
1707 'type' => 'checkbox',
1711 'key' => 'svc_external-display_type',
1713 'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
1715 'select_enum' => [ 'generic', 'artera_turbo', ],
1719 'key' => 'ticket_system',
1721 'description' => 'Ticketing system integration. <b>RT_Internal</b> uses the built-in RT ticketing system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:RT_Installation">integrated ticketing installation instructions</a>). <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
1723 #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
1724 'select_enum' => [ '', qw(RT_Internal RT_External) ],
1728 'key' => 'ticket_system-default_queueid',
1730 'description' => 'Default queue used when creating new customer tickets.',
1731 'type' => 'select-sub',
1732 'options_sub' => sub {
1733 my $conf = new FS::Conf;
1734 if ( $conf->config('ticket_system') ) {
1735 eval "use FS::TicketSystem;";
1737 FS::TicketSystem->queues();
1742 'option_sub' => sub {
1743 my $conf = new FS::Conf;
1744 if ( $conf->config('ticket_system') ) {
1745 eval "use FS::TicketSystem;";
1747 FS::TicketSystem->queue(shift);
1755 'key' => 'ticket_system-priority_reverse',
1757 'description' => 'Enable this to consider lower numbered priorities more important. A bad habit we picked up somewhere. You probably want to avoid it and use the default.',
1758 'type' => 'checkbox',
1762 'key' => 'ticket_system-custom_priority_field',
1764 'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
1769 'key' => 'ticket_system-custom_priority_field-values',
1771 'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
1772 'type' => 'textarea',
1776 'key' => 'ticket_system-custom_priority_field_queue',
1778 'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
1783 'key' => 'ticket_system-rt_external_datasrc',
1785 'description' => 'With external RT integration, the DBI data source for the external RT installation, for example, <code>DBI:Pg:user=rt_user;password=rt_word;host=rt.example.com;dbname=rt</code>',
1791 'key' => 'ticket_system-rt_external_url',
1793 'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
1798 'key' => 'company_name',
1799 'section' => 'required',
1800 'description' => 'Your company name',
1805 'key' => 'company_address',
1806 'section' => 'required',
1807 'description' => 'Your company address',
1808 'type' => 'textarea',
1812 'key' => 'address2-search',
1814 'description' => 'Enable a "Unit" search box which searches the second address field. Useful for multi-tenant applications. See also: cust_main-require_address2',
1815 'type' => 'checkbox',
1819 'key' => 'cust_main-require_address2',
1821 'description' => 'Second address field is required (on service address only, if billing and service addresses differ). Also enables "Unit" labeling of address2 on customer view and edit pages. Useful for multi-tenant applications. See also: address2-search',
1822 'type' => 'checkbox',
1826 'key' => 'agent-ship_address',
1828 'description' => "Use the agent's master service address as the service address (only ship_address2 can be entered, if blank on the master address). Useful for multi-tenant applications.",
1829 'type' => 'checkbox',
1832 { 'key' => 'referral_credit',
1833 'section' => 'deprecated',
1834 'description' => "Used to enable one-time referral credits in the amount of one month <i>referred</i> customer's recurring fee (irregardless of frequency). Replace with a billing event on appropriate packages.",
1835 'type' => 'checkbox',
1838 { 'key' => 'selfservice_server-cache_module',
1840 'description' => 'Module used to store self-service session information. All modules handle any number of self-service servers. Cache::SharedMemoryCache is appropriate for a single database / single Freeside server. Cache::FileCache is useful for multiple databases on a single server, or when IPC::ShareLite is not available (i.e. FreeBSD).', # _Database stores session information in the database and is appropriate for multiple Freeside servers, but may be slower.',
1842 'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
1847 'section' => 'billing',
1848 'description' => 'Options for a HylaFAX server to enable the FAX invoice destination. They should be in the form of a space separated list of arguments to the Fax::Hylafax::Client::sendfax subroutine. You probably shouldn\'t override things like \'docfile\'. *Note* Only supported when using typeset invoices (see the invoice_latex configuration option).',
1849 'type' => [qw( checkbox textarea )],
1853 'key' => 'cust_bill-ftpformat',
1854 'section' => 'billing',
1855 'description' => 'Enable FTP of raw invoice data - format.',
1857 'select_enum' => [ '', 'default', 'billco', ],
1861 'key' => 'cust_bill-ftpserver',
1862 'section' => 'billing',
1863 'description' => 'Enable FTP of raw invoice data - server.',
1868 'key' => 'cust_bill-ftpusername',
1869 'section' => 'billing',
1870 'description' => 'Enable FTP of raw invoice data - server.',
1875 'key' => 'cust_bill-ftppassword',
1876 'section' => 'billing',
1877 'description' => 'Enable FTP of raw invoice data - server.',
1882 'key' => 'cust_bill-ftpdir',
1883 'section' => 'billing',
1884 'description' => 'Enable FTP of raw invoice data - server.',
1889 'key' => 'cust_bill-spoolformat',
1890 'section' => 'billing',
1891 'description' => 'Enable spooling of raw invoice data - format.',
1893 'select_enum' => [ '', 'default', 'billco', ],
1897 'key' => 'cust_bill-spoolagent',
1898 'section' => 'billing',
1899 'description' => 'Enable per-agent spooling of raw invoice data.',
1900 'type' => 'checkbox',
1904 'key' => 'svc_acct-usage_suspend',
1905 'section' => 'billing',
1906 'description' => 'Suspends the package an account belongs to when svc_acct.seconds or a bytecount is decremented to 0 or below (accounts with an empty seconds and up|down|totalbytes value are ignored). Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1907 'type' => 'checkbox',
1911 'key' => 'svc_acct-usage_unsuspend',
1912 'section' => 'billing',
1913 'description' => 'Unuspends the package an account belongs to when svc_acct.seconds or a bytecount is incremented from 0 or below to a positive value (accounts with an empty seconds and up|down|totalbytes value are ignored). Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd.',
1914 'type' => 'checkbox',
1918 'key' => 'svc_acct-usage_threshold',
1919 'section' => 'billing',
1920 'description' => 'The threshold (expressed as percentage) of acct.seconds or acct.up|down|totalbytes at which a warning message is sent to a service holder. Typically used in conjunction with prepaid packages and freeside-sqlradius-radacctd. Defaults to 80.',
1925 'key' => 'cust-fields',
1927 'description' => 'Which customer fields to display on reports by default',
1929 'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
1933 'key' => 'cust_pkg-display_times',
1935 'description' => 'Display full timestamps (not just dates) for customer packages. Useful if you are doing real-time things like hourly prepaid.',
1936 'type' => 'checkbox',
1940 'key' => 'svc_acct-edit_uid',
1941 'section' => 'shell',
1942 'description' => 'Allow UID editing.',
1943 'type' => 'checkbox',
1947 'key' => 'svc_acct-edit_gid',
1948 'section' => 'shell',
1949 'description' => 'Allow GID editing.',
1950 'type' => 'checkbox',
1954 'key' => 'zone-underscore',
1955 'section' => 'BIND',
1956 'description' => 'Allow underscores in zone names. As underscores are illegal characters in zone names, this option is not recommended.',
1957 'type' => 'checkbox',
1961 'key' => 'echeck-nonus',
1962 'section' => 'billing',
1963 'description' => 'Disable ABA-format account checking for Electronic Check payment info',
1964 'type' => 'checkbox',
1968 'key' => 'voip-cust_cdr_spools',
1970 'description' => 'Enable the per-customer option for individual CDR spools.',
1971 'type' => 'checkbox',
1975 'key' => 'voip-cust_cdr_squelch',
1977 'description' => 'Enable the per-customer option for not printing CDR on invoices.',
1978 'type' => 'checkbox',
1982 'key' => 'svc_forward-arbitrary_dst',
1984 'description' => "Allow forwards to point to arbitrary strings that don't necessarily look like email addresses. Only used when using forwards for weird, non-email things.",
1985 'type' => 'checkbox',
1989 'key' => 'tax-ship_address',
1990 'section' => 'billing',
1991 'description' => 'By default, tax calculations are done based on the billing address. Enable this switch to calculate tax based on the shipping address instead. Note: Tax reports can take a long time when enabled.',
1992 'type' => 'checkbox',
1996 'key' => 'invoice-ship_address',
1997 'section' => 'billing',
1998 'description' => 'Enable this switch to include the ship address on the invoice.',
1999 'type' => 'checkbox',
2003 'key' => 'invoice-unitprice',
2004 'section' => 'billing',
2005 'description' => 'This switch enables unit pricing on the invoice.',
2006 'type' => 'checkbox',
2010 'key' => 'postal_invoice-fee_pkgpart',
2011 'section' => 'billing',
2012 'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
2013 'type' => 'select-sub',
2014 'options_sub' => sub { require FS::Record;
2015 require FS::part_pkg;
2016 map { $_->pkgpart => $_->pkg }
2017 FS::Record::qsearch('part_pkg', { disabled=>'' } );
2019 'option_sub' => sub { require FS::Record;
2020 require FS::part_pkg;
2021 my $part_pkg = FS::Record::qsearchs(
2022 'part_pkg', { 'pkgpart'=>shift }
2024 $part_pkg ? $part_pkg->pkg : '';
2029 'key' => 'postal_invoice-recurring_only',
2030 'section' => 'billing',
2031 'description' => 'The postal invoice fee is omitted on invoices without reucrring charges when this is set.',
2032 'type' => 'checkbox',
2036 'key' => 'batch-enable',
2037 'section' => 'deprecated', #make sure batch-enable_payby is set for
2038 #everyone before removing
2039 'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
2040 'type' => 'checkbox',
2044 'key' => 'batch-enable_payby',
2045 'section' => 'billing',
2046 'description' => 'Enable batch processing for the specified payment types.',
2047 'type' => 'selectmultiple',
2048 'select_enum' => [qw( CARD CHEK )],
2052 'key' => 'realtime-disable_payby',
2053 'section' => 'billing',
2054 'description' => 'Disable realtime processing for the specified payment types.',
2055 'type' => 'selectmultiple',
2056 'select_enum' => [qw( CARD CHEK )],
2060 'key' => 'batch-default_format',
2061 'section' => 'billing',
2062 'description' => 'Default format for batches.',
2064 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch',
2065 'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
2071 'key' => 'batch-fixed_format-CARD',
2072 'section' => 'billing',
2073 'description' => 'Fixed (unchangeable) format for credit card batches.',
2075 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
2076 'csv-chase_canada-E-xactBatch', 'BoM', 'PAP' ]
2080 'key' => 'batch-fixed_format-CHEK',
2081 'section' => 'billing',
2082 'description' => 'Fixed (unchangeable) format for electronic check batches.',
2084 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP',
2090 'key' => 'batch-increment_expiration',
2091 'section' => 'billing',
2092 'description' => 'Increment expiration date years in batches until cards are current. Make sure this is acceptable to your batching provider before enabling.',
2093 'type' => 'checkbox'
2097 'key' => 'batchconfig-BoM',
2098 'section' => 'billing',
2099 'description' => 'Configuration for Bank of Montreal batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
2100 'type' => 'textarea',
2104 'key' => 'batchconfig-PAP',
2105 'section' => 'billing',
2106 'description' => 'Configuration for PAP batching, seven lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Long name, 6. Bank, 7. Bank account',
2107 'type' => 'textarea',
2111 'key' => 'batchconfig-csv-chase_canada-E-xactBatch',
2112 'section' => 'billing',
2113 'description' => 'Gateway ID for Chase Canada E-xact batching',
2118 'key' => 'payment_history-years',
2120 'description' => 'Number of years of payment history to show by default. Currently defaults to 2.',
2125 'key' => 'cust_main-use_comments',
2127 'description' => 'Display free form comments on the customer edit screen. Useful as a scratch pad.',
2128 'type' => 'checkbox',
2132 'key' => 'cust_main-disable_notes',
2134 'description' => 'Disable new style customer notes - timestamped and user identified customer notes. Useful in tracking who did what.',
2135 'type' => 'checkbox',
2139 'key' => 'cust_main_note-display_times',
2141 'description' => 'Display full timestamps (not just dates) for customer notes.',
2142 'type' => 'checkbox',
2146 'key' => 'cust_main-ticket_statuses',
2148 'description' => 'Show tickets with these statuses on the customer view page.',
2149 'type' => 'selectmultiple',
2150 'select_enum' => [qw( new open stalled resolved rejected deleted )],
2154 'key' => 'cust_main-max_tickets',
2156 'description' => 'Maximum number of tickets to show on the customer view page.',
2161 'key' => 'cust_main-skeleton_tables',
2163 'description' => 'Tables which will have skeleton records inserted into them for each customer. Syntax for specifying tables is unfortunately a tricky perl data structure for now.',
2164 'type' => 'textarea',
2168 'key' => 'cust_main-skeleton_custnum',
2170 'description' => 'Customer number specifying the source data to copy into skeleton tables for new customers.',
2175 'key' => 'cust_main-enable_birthdate',
2177 'descritpion' => 'Enable tracking of a birth date with each customer record',
2178 'type' => 'checkbox',
2182 'key' => 'support-key',
2184 'description' => 'A support key enables access to commercial services delivered over the network, such as the payroll module, access to the internal ticket system, priority support and optional backups.',
2189 'key' => 'card-types',
2190 'section' => 'billing',
2191 'description' => 'Select one or more card types to enable only those card types. If no card types are selected, all card types are available.',
2192 'type' => 'selectmultiple',
2193 'select_enum' => \@card_types,
2197 'key' => 'disable-fuzzy',
2199 'description' => 'Disable fuzzy searching. Speeds up searching for large sites, but only shows exact matches.',
2200 'type' => 'checkbox',
2203 { 'key' => 'pkg_referral',
2205 'description' => 'Enable package-specific advertising sources.',
2206 'type' => 'checkbox',
2209 { 'key' => 'pkg_referral-multiple',
2211 'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
2212 'type' => 'checkbox',
2216 'key' => 'dashboard-toplist',
2218 'description' => 'List of items to display on the top of the front page',
2219 'type' => 'textarea',
2223 'key' => 'impending_recur_template',
2224 'section' => 'billing',
2225 'description' => 'Template file for alerts about looming first time recurrant billing. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitition language. Also see packages with a <a href="../browse/part_pkg.cgi">flat price plan</a> The following variables are available<ul><li><code>$packages</code> allowing <code>$packages->[0]</code> thru <code>$packages->[n]</code> <li><code>$package</code> the first package, same as <code>$packages->[0]</code> <li><code>$recurdates</code> allowing <code>$recurdates->[0]</code> thru <code>$recurdates->[n]</code> <li><code>$recurdate</code> the first recurdate, same as <code>$recurdate->[0]</code> <li><code>$first</code> <li><code>$last</code></ul>',
2226 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
2227 'type' => 'textarea',
2231 'key' => 'logo.png',
2232 'section' => 'billing', #?
2233 'description' => 'An image to include in some types of invoices',
2238 'key' => 'logo.eps',
2239 'section' => 'billing', #?
2240 'description' => 'An image to include in some types of invoices',
2245 'key' => 'selfservice-ignore_quantity',
2247 'description' => 'Ignores service quantity restrictions in self-service context. Strongly not recommended - just set your quantities correctly in the first place.',
2248 'type' => 'checkbox',
2252 'key' => 'selfservice-session_timeout',
2254 'description' => 'Self-service session timeout. Defaults to 1 hour.',
2256 'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
2260 'key' => 'disable_setup_suspended_pkgs',
2261 'section' => 'billing',
2262 'description' => 'Disables charging of setup fees for suspended packages.',
2263 'type' => 'checkbox',
2267 'key' => 'password-generated-allcaps',
2268 'section' => 'password',
2269 'description' => 'Causes passwords automatically generated to consist entirely of capital letters',
2270 'type' => 'checkbox',
2274 'key' => 'datavolume-forcemegabytes',
2276 'description' => 'All data volumes are expressed in megabytes',
2277 'type' => 'checkbox',
2281 'key' => 'datavolume-significantdigits',
2283 'description' => 'number of significant digits to use to represent data volumes',
2288 'key' => 'disable_void_after',
2289 'section' => 'billing',
2290 'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
2295 'key' => 'disable_line_item_date_ranges',
2296 'section' => 'billing',
2297 'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
2298 'type' => 'checkbox',
2302 'key' => 'support_packages',
2304 'description' => 'A list of packages eligible for RT ticket time transfer, one pkgpart per line.', #this should really be a select multiple, or specified in the packages themselves...
2305 'type' => 'textarea',
2309 'key' => 'cust_main-require_phone',
2311 'description' => 'Require daytime or night phone for all customer records.',
2312 'type' => 'checkbox',
2316 'key' => 'cust_main-require_invoicing_list_email',
2318 'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
2319 'type' => 'checkbox',
2323 'key' => 'svc_acct-display_paid_time_remaining',
2325 'description' => 'Show paid time remaining in addition to time remaining.',
2326 'type' => 'checkbox',
2330 'key' => 'cancel_credit_type',
2331 'section' => 'billing',
2332 'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
2333 'type' => 'select-sub',
2334 'options_sub' => sub { require FS::Record;
2335 require FS::reason_type;
2336 map { $_->typenum => $_->type }
2337 FS::Record::qsearch('reason_type', { class=>'R' } );
2339 'option_sub' => sub { require FS::Record;
2340 require FS::reason_type;
2341 my $reason_type = FS::Record::qsearchs(
2342 'reason_type', { 'typenum' => shift }
2344 $reason_type ? $reason_type->type : '';
2349 'key' => 'referral_credit_type',
2350 'section' => 'deprecated',
2351 'description' => 'Used to be the group to use for new, automatically generated credit reasons resulting from referrals. Now set in a package billing event for the referral.',
2352 'type' => 'select-sub',
2353 'options_sub' => sub { require FS::Record;
2354 require FS::reason_type;
2355 map { $_->typenum => $_->type }
2356 FS::Record::qsearch('reason_type', { class=>'R' } );
2358 'option_sub' => sub { require FS::Record;
2359 require FS::reason_type;
2360 my $reason_type = FS::Record::qsearchs(
2361 'reason_type', { 'typenum' => shift }
2363 $reason_type ? $reason_type->type : '';
2368 'key' => 'signup_credit_type',
2369 'section' => 'billing',
2370 'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
2371 'type' => 'select-sub',
2372 'options_sub' => sub { require FS::Record;
2373 require FS::reason_type;
2374 map { $_->typenum => $_->type }
2375 FS::Record::qsearch('reason_type', { class=>'R' } );
2377 'option_sub' => sub { require FS::Record;
2378 require FS::reason_type;
2379 my $reason_type = FS::Record::qsearchs(
2380 'reason_type', { 'typenum' => shift }
2382 $reason_type ? $reason_type->type : '';
2387 'key' => 'cust_main-agent_custid-format',
2389 'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
2392 '' => 'Numeric only',
2393 'ww?d+' => 'Numeric with one or two letter prefix',
2398 'key' => 'card_masking_method',
2400 'description' => 'Digits to display when masking credit cards. Note that the first six digits are necessary to canonically identify the credit card type (Visa/MC, Amex, Discover, Maestro, etc.) in all cases. The first four digits can identify the most common credit card types in most cases (Visa/MC, Amex, and Discover). The first two digits can distinguish between Visa/MC and Amex. Note: You should manually remove stored paymasks if you change this value on an existing database, to avoid problems using stored cards.',
2403 '' => '123456xxxxxx1234',
2404 'first6last2' => '123456xxxxxxxx12',
2405 'first4last4' => '1234xxxxxxxx1234',
2406 'first4last2' => '1234xxxxxxxxxx12',
2407 'first2last4' => '12xxxxxxxxxx1234',
2408 'first2last2' => '12xxxxxxxxxxxx12',
2409 'first0last4' => 'xxxxxxxxxxxx1234',
2410 'first0last2' => 'xxxxxxxxxxxxxx12',
2415 'key' => 'disable_previous_balance',
2416 'section' => 'billing',
2417 'description' => 'Disable inclusion of previous balancem payment, and credit lines on invoices',
2418 'type' => 'checkbox',
2422 'key' => 'usps_webtools-userid',
2424 'description' => 'Production UserID for USPS web tools. Enables USPS address standardization. See the <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
2429 'key' => 'usps_webtools-password',
2431 'description' => 'Production password for USPS web tools. Enables USPS address standardization. See <a href="http://www.usps.com/webtools/">USPS website</a>, register and agree not to use the tools for batch purposes.',
2436 'key' => 'cust_main-auto_standardize_address',
2438 'description' => 'When using USPS web tools, automatically standardize the address without asking.',
2439 'type' => 'checkbox',
2443 'key' => 'disable_acl_changes',
2445 'description' => 'Disable all ACL changes, for demos.',
2446 'type' => 'checkbox',
2450 'key' => 'cust_main-edit_agent_custid',
2452 'description' => 'Enable editing of the agent_custid field.',
2453 'type' => 'checkbox',
2457 'key' => 'cust_main-default_agent_custid',
2459 'description' => 'Display the agent_custid field instead of the custnum field.',
2460 'type' => 'checkbox',
2464 'key' => 'cust_main-auto_agent_custid',
2466 'description' => 'Automatically assign an agent_custid - select format',
2468 'select_hash' => [ '' => 'No',
2469 '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
2474 'key' => 'cust_main-default_areacode',
2476 'description' => 'Default area code for customers.',
2481 'key' => 'mcp_svcpart',
2483 'description' => 'Master Control Program svcpart. Leave this blank.',
2488 'key' => 'cust_bill-max_same_services',
2489 'section' => 'billing',
2490 'description' => 'Maximum number of the same service to list individually on invoices before condensing to a single line listing the number of services. Defaults to 5.',
2495 'key' => 'suspend_email_admin',
2497 'description' => 'Destination admin email address to enable suspension notices',
2502 'key' => 'email_report-subject',
2504 'description' => 'Subject for reports emailed by freeside-fetch. Defaults to "Freeside report".',
2509 'key' => 'selfservice-head',
2511 'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
2512 'type' => 'textarea', #htmlarea?
2517 'key' => 'selfservice-body_header',
2519 'description' => 'HTML header for the self-service interface',
2520 'type' => 'textarea', #htmlarea?
2524 'key' => 'selfservice-body_footer',
2526 'description' => 'HTML header for the self-service interface',
2527 'type' => 'textarea', #htmlarea?
2532 'key' => 'selfservice-body_bgcolor',
2534 'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
2539 'key' => 'selfservice-box_bgcolor',
2541 'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0"',
2546 'key' => 'signup-no_company',
2548 'description' => "Don't display a field for company name on signup.",
2549 'type' => 'checkbox',
2553 'key' => 'signup-recommend_email',
2555 'description' => 'Encourage the entry of an invoicing email address on signup.',
2556 'type' => 'checkbox',
2560 'key' => 'signup-recommend_daytime',
2562 'description' => 'Encourage the entry of a daytime phone number invoicing email address on signup.',
2563 'type' => 'checkbox',
2567 'key' => 'svc_phone-radius-default_password',
2569 'description' => 'Default password when exporting svc_phone records to RADIUS',
2574 'key' => 'svc_phone-allow_alpha_phonenum',
2576 'description' => 'Allow letters in phone numbers.',
2577 'type' => 'checkbox',
2581 'key' => 'default_phone_countrycode',
2583 'description' => 'Default countrcode',
2588 'key' => 'cdr-charged_party-accountcode',
2590 'description' => 'Set the charged_party field of CDRs to the accountcode.',
2591 'type' => 'checkbox',