RT# 34134 - removed config option manual_process-single_invoice_amount from config...
[freeside.git] / FS / FS / Conf.pm
1 package FS::Conf;
2
3 use strict;
4 use vars qw( $base_dir @config_items @base_items @card_types @invoice_terms
5              $DEBUG
6              $conf_cache $conf_cache_enabled
7            );
8 use Carp;
9 use IO::File;
10 use File::Basename;
11 use MIME::Base64;
12 use Locale::Currency;
13 use Email::Address;
14 use FS::ConfItem;
15 use FS::ConfDefaults;
16 use FS::Locales;
17 use FS::payby;
18 use FS::conf;
19 use FS::Record qw(qsearch qsearchs);
20 use FS::UID qw(dbh datasrc);
21 use FS::Misc::Invoicing qw( spool_formats );
22
23 $base_dir = '%%%FREESIDE_CONF%%%';
24
25 $DEBUG = 0;
26
27 $conf_cache_enabled = 0;
28
29 =head1 NAME
30
31 FS::Conf - Freeside configuration values
32
33 =head1 SYNOPSIS
34
35   use FS::Conf;
36
37   $conf = new FS::Conf;
38
39   $value = $conf->config('key');
40   @list  = $conf->config('key');
41   $bool  = $conf->exists('key');
42
43   $conf->touch('key');
44   $conf->set('key' => 'value');
45   $conf->delete('key');
46
47   @config_items = $conf->config_items;
48
49 =head1 DESCRIPTION
50
51 Read and write Freeside configuration values.  Keys currently map to filenames,
52 but this may change in the future.
53
54 =head1 METHODS
55
56 =over 4
57
58 =item new [ HASHREF ]
59
60 Create a new configuration object.
61
62 HASHREF may contain options to set the configuration context.  Currently 
63 accepts C<locale>, and C<localeonly> to disable fallback to the null locale.
64
65 =cut
66
67 sub new {
68   my($proto) = shift;
69   my $opts = shift || {};
70   my($class) = ref($proto) || $proto;
71   my $self = {
72     'base_dir'    => $base_dir,
73     'locale'      => $opts->{locale},
74     'localeonly'  => $opts->{localeonly}, # for config-view.cgi ONLY
75   };
76   warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly};
77   bless ($self, $class);
78 }
79
80 =item base_dir
81
82 Returns the base directory.  By default this is /usr/local/etc/freeside.
83
84 =cut
85
86 sub base_dir {
87   my($self) = @_;
88   my $base_dir = $self->{base_dir};
89   -e $base_dir or die "FATAL: $base_dir doesn't exist!";
90   -d $base_dir or die "FATAL: $base_dir isn't a directory!";
91   -r $base_dir or die "FATAL: Can't read $base_dir!";
92   -x $base_dir or die "FATAL: $base_dir not searchable (executable)!";
93   $base_dir =~ /^(.*)$/;
94   $1;
95 }
96
97 =item conf KEY [ AGENTNUM [ NODEFAULT ] ]
98
99 Returns the L<FS::conf> record for the key and agent.
100
101 =cut
102
103 sub conf {
104   my $self = shift;
105   $self->_config(@_);
106 }
107
108 =item config KEY [ AGENTNUM [ NODEFAULT ] ]
109
110 Returns the configuration value or values (depending on context) for key.
111 The optional agent number selects an agent specific value instead of the
112 global default if one is present.  If NODEFAULT is true only the agent
113 specific value(s) is returned.
114
115 =cut
116
117 sub _config {
118   my($self,$name,$agentnum,$agentonly)=@_;
119   my $hashref = { 'name' => $name };
120   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
121   $conf_cache = undef unless $conf_cache_enabled; # use cache only when it is
122                                                   # safe to do so
123   my $cv;
124   my @a = (
125     ($agentnum || ()),
126     ($agentonly && $agentnum ? () : '')
127   );
128   my @l = (
129     ($self->{locale} || ()),
130     ($self->{localeonly} && $self->{locale} ? () : '')
131   );
132   # try with the agentnum first, then fall back to no agentnum if allowed
133   foreach my $a (@a) {
134     $hashref->{agentnum} = $a;
135     foreach my $l (@l) {
136       my $key = join(':',$name, $a, $l);
137       if (! exists $conf_cache->{$key}){
138         $hashref->{locale} = $l;
139         # $conf_cache is reset in FS::UID during myconnect, so the cache is
140         # reset per connection
141         $conf_cache->{$key} = FS::Record::qsearchs('conf', $hashref);
142       }
143       return $conf_cache->{$key} if $conf_cache->{$key};
144     }
145   }
146   return undef;
147 }
148
149 sub config {
150   my $self = shift;
151
152   carp "FS::Conf->config(". join(', ', @_). ") called"
153     if $DEBUG > 1;
154
155   my $cv = $self->_config(@_) or return;
156
157   if ( wantarray ) {
158     my $v = $cv->value;
159     chomp $v;
160     (split "\n", $v, -1);
161   } else {
162     (split("\n", $cv->value))[0];
163   }
164 }
165
166 =item config_binary KEY [ AGENTNUM [ NODEFAULT ] ]
167
168 Returns the exact scalar value for key.
169
170 =cut
171
172 sub config_binary {
173   my $self = shift;
174
175   my $cv = $self->_config(@_) or return;
176   length($cv->value) ? decode_base64($cv->value) : '';
177 }
178
179 =item exists KEY [ AGENTNUM [ NODEFAULT ] ]
180
181 Returns true if the specified key exists, even if the corresponding value
182 is undefined.
183
184 =cut
185
186 sub exists {
187   my $self = shift;
188
189   #my($name, $agentnum)=@_;
190
191   carp "FS::Conf->exists(". join(', ', @_). ") called"
192     if $DEBUG > 1;
193
194   defined($self->_config(@_));
195 }
196
197 #maybe this should just be the new exists instead of getting a method of its
198 #own, but i wanted to avoid possible fallout
199
200 sub config_bool {
201   my $self = shift;
202
203   my($name,$agentnum,$agentonly) = @_;
204
205   carp "FS::Conf->config_bool(". join(', ', @_). ") called"
206     if $DEBUG > 1;
207
208   #defined($self->_config(@_));
209
210   #false laziness w/_config
211   my $hashref = { 'name' => $name };
212   local $FS::Record::conf = undef;  # XXX evil hack prevents recursion
213   my $cv;
214   my @a = (
215     ($agentnum || ()),
216     ($agentonly && $agentnum ? () : '')
217   );
218   my @l = (
219     ($self->{locale} || ()),
220     ($self->{localeonly} && $self->{locale} ? () : '')
221   );
222   # try with the agentnum first, then fall back to no agentnum if allowed
223   foreach my $a (@a) {
224     $hashref->{agentnum} = $a;
225     foreach my $l (@l) {
226       $hashref->{locale} = $l;
227       $cv = FS::Record::qsearchs('conf', $hashref);
228       if ( $cv ) {
229         if ( $cv->value eq '0'
230                && ($hashref->{agentnum} || $hashref->{locale} )
231            ) 
232         {
233           return 0; #an explicit false override, don't continue looking
234         } else {
235           return 1;
236         }
237       }
238     }
239   }
240   return 0;
241
242 }
243
244 =item config_orbase KEY SUFFIX
245
246 Returns the configuration value or values (depending on context) for 
247 KEY_SUFFIX, if it exists, otherwise for KEY
248
249 =cut
250
251 # outmoded as soon as we shift to agentnum based config values
252 # well, mostly.  still useful for e.g. late notices, etc. in that we want
253 # these to fall back to standard values
254 sub config_orbase {
255   my $self = shift;
256
257   my( $name, $suffix ) = @_;
258   if ( $self->exists("${name}_$suffix") ) {
259     $self->config("${name}_$suffix");
260   } else {
261     $self->config($name);
262   }
263 }
264
265 =item key_orbase KEY SUFFIX
266
267 If the config value KEY_SUFFIX exists, returns KEY_SUFFIX, otherwise returns
268 KEY.  Useful for determining which exact configuration option is returned by
269 config_orbase.
270
271 =cut
272
273 sub key_orbase {
274   my $self = shift;
275
276   my( $name, $suffix ) = @_;
277   if ( $self->exists("${name}_$suffix") ) {
278     "${name}_$suffix";
279   } else {
280     $name;
281   }
282 }
283
284 =item invoice_templatenames
285
286 Returns all possible invoice template names.
287
288 =cut
289
290 sub invoice_templatenames {
291   my( $self ) = @_;
292
293   my %templatenames = ();
294   foreach my $item ( $self->config_items ) {
295     foreach my $base ( @base_items ) {
296       my( $main, $ext) = split(/\./, $base);
297       $ext = ".$ext" if $ext;
298       if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
299       $templatenames{$1}++;
300       }
301     }
302   }
303   
304   map { $_ } #handle scalar context
305   sort keys %templatenames;
306
307 }
308
309 =item touch KEY [ AGENT ];
310
311 Creates the specified configuration key if it does not exist.
312
313 =cut
314
315 sub touch {
316   my $self = shift;
317
318   my($name, $agentnum) = @_;
319   #unless ( $self->exists($name, $agentnum) ) {
320   unless ( $self->config_bool($name, $agentnum) ) {
321     if ( $agentnum && $self->exists($name) && $self->config($name,$agentnum) eq '0' ) {
322       $self->delete($name, $agentnum);
323     } else {
324       $self->set($name, '', $agentnum);
325     }
326   }
327 }
328
329 =item set KEY VALUE [ AGENTNUM ];
330
331 Sets the specified configuration key to the given value.
332
333 =cut
334
335 sub set {
336   my $self = shift;
337
338   my($name, $value, $agentnum) = @_;
339   $value =~ /^(.*)$/s;
340   $value = $1;
341
342   warn "[FS::Conf] SET $name\n" if $DEBUG;
343
344   my $hashref = {
345     name => $name,
346     agentnum => $agentnum,
347     locale => $self->{locale}
348   };
349
350   my $old = FS::Record::qsearchs('conf', $hashref);
351   my $new = new FS::conf { $old ? $old->hash : %$hashref };
352   $new->value($value);
353
354   my $error;
355   if ($old) {
356     $error = $new->replace($old);
357   } else {
358     $error = $new->insert;
359   }
360
361   if (! $error) {
362     # clean the object cache
363     my $key = join(':',$name, $agentnum, $self->{locale});
364     $conf_cache->{ $key } = $new;
365   }
366
367   die "error setting configuration value: $error \n"
368     if $error;
369
370 }
371
372 =item set_binary KEY VALUE [ AGENTNUM ]
373
374 Sets the specified configuration key to an exact scalar value which
375 can be retrieved with config_binary.
376
377 =cut
378
379 sub set_binary {
380   my $self  = shift;
381
382   my($name, $value, $agentnum)=@_;
383   $self->set($name, encode_base64($value), $agentnum);
384 }
385
386 =item delete KEY [ AGENTNUM ];
387
388 Deletes the specified configuration key.
389
390 =cut
391
392 sub delete {
393   my $self = shift;
394
395   my($name, $agentnum) = @_;
396   if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) {
397     warn "[FS::Conf] DELETE $name\n" if $DEBUG;
398
399     my $oldAutoCommit = $FS::UID::AutoCommit;
400     local $FS::UID::AutoCommit = 0;
401     my $dbh = dbh;
402
403     my $error = $cv->delete;
404
405     if ( $error ) {
406       $dbh->rollback if $oldAutoCommit;
407       die "error setting configuration value: $error \n"
408     }
409
410     $dbh->commit or die $dbh->errstr if $oldAutoCommit;
411
412   }
413 }
414
415 #maybe this should just be the new delete instead of getting a method of its
416 #own, but i wanted to avoid possible fallout
417
418 sub delete_bool {
419   my $self = shift;
420
421   my($name, $agentnum) = @_;
422
423   warn "[FS::Conf] DELETE $name\n" if $DEBUG;
424
425   my $cv = FS::Record::qsearchs('conf', { name     => $name,
426                                           agentnum => $agentnum,
427                                           locale   => $self->{locale},
428                                         });
429
430   if ( $cv ) {
431     my $error = $cv->delete;
432     die $error if $error;
433   } elsif ( $agentnum ) {
434     $self->set($name, '0', $agentnum);
435   }
436
437 }
438
439 =item import_config_item CONFITEM DIR 
440
441   Imports the item specified by the CONFITEM (see L<FS::ConfItem>) into
442 the database as a conf record (see L<FS::conf>).  Imports from the file
443 in the directory DIR.
444
445 =cut
446
447 sub import_config_item { 
448   my ($self,$item,$dir) = @_;
449   my $key = $item->key;
450   if ( -e "$dir/$key" ) {
451     warn "Inserting $key\n" if $DEBUG;
452     local $/;
453     my $value = readline(new IO::File "$dir/$key");
454     if ($item->type =~ /^(binary|image)$/ ) {
455       $self->set_binary($key, $value);
456     }else{
457       $self->set($key, $value);
458     }
459   } else {
460     warn "Not inserting $key\n" if $DEBUG;
461   }
462 }
463
464 #item _orbase_items OPTIONS
465 #
466 #Returns all of the possible extensible config items as FS::ConfItem objects.
467 #See #L<FS::ConfItem>.  OPTIONS consists of name value pairs.  Possible
468 #options include
469 #
470 # dir - the directory to search for configuration option files instead
471 #       of using the conf records in the database
472 #
473 #cut
474
475 #quelle kludge
476 sub _orbase_items {
477   my ($self, %opt) = @_; 
478
479   my $listmaker = sub { my $v = shift;
480                         $v =~ s/_/!_/g;
481                         if ( $v =~ /\.(png|eps)$/ ) {
482                           $v =~ s/\./!_%./;
483                         }else{
484                           $v .= '!_%';
485                         }
486                         map { $_->name }
487                           FS::Record::qsearch( 'conf',
488                                                {},
489                                                '',
490                                                "WHERE name LIKE '$v' ESCAPE '!'"
491                                              );
492                       };
493
494   if (exists($opt{dir}) && $opt{dir}) {
495     $listmaker = sub { my $v = shift;
496                        if ( $v =~ /\.(png|eps)$/ ) {
497                          $v =~ s/\./_*./;
498                        }else{
499                          $v .= '_*';
500                        }
501                        map { basename $_ } glob($opt{dir}. "/$v" );
502                      };
503   }
504
505   ( map { 
506           my $proto;
507           my $base = $_;
508           for ( @config_items ) { $proto = $_; last if $proto->key eq $base;  }
509           die "don't know about $base items" unless $proto->key eq $base;
510
511           map { new FS::ConfItem { 
512                   'key'         => $_,
513                   'base_key'    => $proto->key,
514                   'section'     => $proto->section,
515                   'description' => 'Alternate ' . $proto->description . '  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Administration#Invoice_templates">billing documentation</a> for details.',
516                   'type'        => $proto->type,
517                 };
518               } &$listmaker($base);
519         } @base_items,
520   );
521 }
522
523 =item config_items
524
525 Returns all of the possible global/default configuration items as
526 FS::ConfItem objects.  See L<FS::ConfItem>.
527
528 =cut
529
530 sub config_items {
531   my $self = shift; 
532
533   ( @config_items, $self->_orbase_items(@_) );
534 }
535
536 =item invoice_from_full [ AGENTNUM ]
537
538 Returns values of invoice_from and invoice_from_name (or, if that is not
539 defined, company_name), appropriately combined based on their current values.
540
541 =cut
542
543 sub invoice_from_full {
544   my ($self, $agentnum) = @_;
545
546   my $name =  $self->config('invoice_from_name', $agentnum)
547            || $self->config('company_name', $agentnum);
548
549   Email::Address->new( $name => $self->config('invoice_from', $agentnum ) )
550     ->format;
551 }
552
553 =back
554
555 =head1 SUBROUTINES
556
557 =over 4
558
559 =item init-config DIR
560
561 Imports the configuration items from DIR (1.7 compatible)
562 to conf records in the database.
563
564 =cut
565
566 sub init_config {
567   my $dir = shift;
568
569   my $conf = new FS::Conf;
570   foreach my $item ( $conf->config_items(dir => $dir) ) {
571     $conf->import_config_item($item, $dir);
572   }
573
574   '';  #success
575 }
576
577 =back
578
579 =head1 BUGS
580
581 If this was more than just crud that will never be useful outside Freeside I'd
582 worry that config_items is freeside-specific and icky.
583
584 =head1 SEE ALSO
585
586 "Configuration" in the web interface (config/config.cgi).
587
588 =cut
589
590 #Business::CreditCard
591 @card_types = (
592   "VISA card",
593   "MasterCard",
594   "Discover card",
595   "American Express card",
596   "Diner's Club/Carte Blanche",
597   "enRoute",
598   "JCB",
599   "BankCard",
600   "Switch",
601   "Solo",
602 );
603
604 @base_items = qw(
605 invoice_template
606 invoice_latex
607 invoice_latexreturnaddress
608 invoice_latexfooter
609 invoice_latexsmallfooter
610 invoice_latexnotes
611 invoice_latexcoupon
612 invoice_latexwatermark
613 invoice_html
614 invoice_htmlreturnaddress
615 invoice_htmlfooter
616 invoice_htmlnotes
617 invoice_htmlwatermark
618 logo.png
619 logo.eps
620 );
621
622 @invoice_terms = (
623   '',
624   'Payable upon receipt',
625   'Net 0', 'Net 3', 'Net 5', 'Net 7', 'Net 9', 'Net 10', 'Net 14', 
626   'Net 15', 'Net 18', 'Net 20', 'Net 21', 'Net 25', 'End of Month', 'Net 30',
627   'Net 45', 'Net 60', 'Net 90'
628 );
629
630 my %msg_template_options = (
631   'type'        => 'select-sub',
632   'options_sub' => sub { 
633     my @templates = qsearch({
634         'table' => 'msg_template', 
635         'hashref' => { 'disabled' => '' },
636         'extra_sql' => ' AND '. 
637           $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
638         });
639     map { $_->msgnum, $_->msgname } @templates;
640   },
641   'option_sub'  => sub { 
642                          my $msg_template = FS::msg_template->by_key(shift);
643                          $msg_template ? $msg_template->msgname : ''
644                        },
645   'per_agent' => 1,
646 );
647
648 my %payment_gateway_options = (
649   'type'        => 'select-sub',
650   'options_sub' => sub {
651     my @gateways = qsearch({
652         'table' => 'payment_gateway',
653         'hashref' => { 'disabled' => '' },
654       });
655     map { $_->gatewaynum, $_->label } @gateways;
656   },
657   'option_sub'  => sub {
658     my $gateway = FS::payment_gateway->by_key(shift);
659     $gateway ? $gateway->label : ''
660   },
661 );
662
663 my %batch_gateway_options = (
664   %payment_gateway_options,
665   'options_sub' => sub {
666     my @gateways = qsearch('payment_gateway',
667       {
668         'disabled'          => '',
669         'gateway_namespace' => 'Business::BatchPayment',
670       }
671     );
672     map { $_->gatewaynum, $_->label } @gateways;
673   },
674   'per_agent' => 1,
675 );
676
677 my %invoice_mode_options = (
678   'type'        => 'select-sub',
679   'options_sub' => sub { 
680     my @modes = qsearch({
681         'table' => 'invoice_mode', 
682         'extra_sql' => ' WHERE '.
683           $FS::CurrentUser::CurrentUser->agentnums_sql(null => 1),
684         });
685     map { $_->modenum, $_->modename } @modes;
686   },
687   'option_sub'  => sub { 
688                          my $mode = FS::invoice_mode->by_key(shift);
689                          $mode ? $mode->modename : '',
690                        },
691   'per_agent' => 1,
692 );
693
694 my @cdr_formats = (
695   '' => '',
696   'default' => 'Default',
697   'source_default' => 'Default with source',
698   'accountcode_default' => 'Default plus accountcode',
699   'description_default' => 'Default with description field as destination',
700   'basic' => 'Basic',
701   'simple' => 'Simple',
702   'simple2' => 'Simple with source',
703   'accountcode_simple' => 'Simple with accountcode',
704 );
705
706 # takes the reason class (C, R, S) as an argument
707 sub reason_type_options {
708   my $reason_class = shift;
709
710   'type'        => 'select-sub',
711   'options_sub' => sub {
712     map { $_->typenum => $_->type } 
713       qsearch('reason_type', { class => $reason_class });
714   },
715   'option_sub'  => sub {
716     my $type = FS::reason_type->by_key(shift);
717     $type ? $type->type : '';
718   }
719 }
720
721 my $validate_email = sub { $_[0] =~
722                              /^[^@]+\@[[:alnum:]-]+(\.[[:alnum:]-]+)+$/
723                              ? '' : 'Invalid email address';
724                          };
725
726 #Billing (81 items)
727 #Invoicing (50 items)
728 #UI (69 items)
729 #Self-service (29 items)
730 #...
731 #Unclassified (77 items)
732
733 @config_items = map { new FS::ConfItem $_ } (
734
735   {
736     'key'         => 'event_log_level',
737     'section'     => 'notification',
738     'description' => 'Store events in the internal log if they are at least this severe.  "info" is the default, "debug" is very detailed and noisy.',
739     'type'        => 'select',
740     'select_enum' => [ '', 'debug', 'info', 'notice', 'warning', 'error', ],
741     # don't bother with higher levels
742   },
743
744   {
745     'key'         => 'log_sent_mail',
746     'section'     => 'notification',
747     'description' => 'Enable logging of all sent email.',
748     'type'        => 'checkbox',
749   },
750
751   {
752     'key'         => 'part_pkg-lineage',
753     'section'     => 'packages',
754     'description' => 'When editing a package definition, if setup or recur fees are changed, create a new package rather than changing the existing package.',
755     'type'        => 'checkbox',
756   },
757
758   {
759     'key'         => 'apacheip',
760     #not actually deprecated yet
761     #'section'     => 'deprecated',
762     #'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',
763     'section'     => 'services',
764     'description' => 'IP address to assign to new virtual hosts',
765     'type'        => 'text',
766   },
767   
768   {
769     'key'         => 'credits-auto-apply-disable',
770     'section'     => 'billing',
771     'description' => 'Disable the "Auto-Apply to invoices" UI option for new credits',
772     'type'        => 'checkbox',
773   },
774   
775   {
776     'key'         => 'credit-card-surcharge-percentage',
777     'section'     => 'credit_cards',
778     'description' => 'Add a credit card surcharge to invoices, as a % of the invoice total.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas.  Surcharging is also generally prohibited in most countries outside the US, AU and UK.  When allowed, typically not permitted to be above 4%.',
779     'type'        => 'text',
780     'per_agent'   => 1,
781   },
782
783   {
784     'key'         => 'discount-show-always',
785     'section'     => 'invoicing',
786     'description' => 'Generate a line item on an invoice even when a package is discounted 100%',
787     'type'        => 'checkbox',
788   },
789
790   {
791     'key'         => 'discount-show_available',
792     'section'     => 'invoicing',
793     'description' => 'Show available prepayment discounts on invoices.',
794     'type'        => 'checkbox',
795   },
796
797   {
798     'key'         => 'invoice-barcode',
799     'section'     => 'invoicing',
800     'description' => 'Display a barcode on HTML and PDF invoices',
801     'type'        => 'checkbox',
802   },
803   
804   {
805     'key'         => 'cust_main-select-billday',
806     'section'     => 'payments',
807     'description' => 'When used with a specific billing event, allows the selection of the day of month on which to charge credit card / bank account automatically, on a per-customer basis',
808     'type'        => 'checkbox',
809   },
810
811   {
812     'key'         => 'cust_main-select-prorate_day',
813     'section'     => 'billing',
814     'description' => 'When used with prorate or anniversary packages, allows the selection of the prorate day of month, on a per-customer basis',
815     'type'        => 'checkbox',
816   },
817
818   {
819     'key'         => 'anniversary-rollback',
820     'section'     => 'billing',
821     'description' => 'When billing an anniversary package ordered after the 28th, roll the anniversary date back to the 28th instead of forward into the following month.',
822     'type'        => 'checkbox',
823   },
824
825   {
826     'key'         => 'encryption',
827     'section'     => 'credit_cards',
828     'description' => 'Enable encryption of credit cards and echeck numbers',
829     'type'        => 'checkbox',
830   },
831
832   {
833     'key'         => 'encryptionmodule',
834     'section'     => 'credit_cards',
835     'description' => 'Use which module for encryption?',
836     'type'        => 'select',
837     'select_enum' => [ '', 'Crypt::OpenSSL::RSA', ],
838   },
839
840   {
841     'key'         => 'encryptionpublickey',
842     'section'     => 'credit_cards',
843     'description' => 'Encryption public key',
844     'type'        => 'textarea',
845   },
846
847   {
848     'key'         => 'encryptionprivatekey',
849     'section'     => 'credit_cards',
850     'description' => 'Encryption private key',
851     'type'        => 'textarea',
852   },
853
854   {
855     'key'         => 'billco-url',
856     'section'     => 'print_services',
857     'description' => 'The url to use for performing uploads to the invoice mailing service.',
858     'type'        => 'text',
859     'per_agent'   => 1,
860   },
861
862   {
863     'key'         => 'billco-username',
864     'section'     => 'print_services',
865     'description' => 'The login name to use for uploads to the invoice mailing service.',
866     'type'        => 'text',
867     'per_agent'   => 1,
868     'agentonly'   => 1,
869   },
870
871   {
872     'key'         => 'billco-password',
873     'section'     => 'print_services',
874     'description' => 'The password to use for uploads to the invoice mailing service.',
875     'type'        => 'text',
876     'per_agent'   => 1,
877     'agentonly'   => 1,
878   },
879
880   {
881     'key'         => 'billco-clicode',
882     'section'     => 'print_services',
883     'description' => 'The clicode to use for uploads to the invoice mailing service.',
884     'type'        => 'text',
885     'per_agent'   => 1,
886   },
887
888   {
889     'key'         => 'billco-account_num',
890     'section'     => 'print_services',
891     'description' => 'The data to place in the "Transaction Account No" / "TRACCTNUM" field.',
892     'type'        => 'select',
893     'select_hash' => [
894                        'invnum-date' => 'Invoice number - Date (default)',
895                        'display_custnum'  => 'Customer number',
896                      ],
897     'per_agent'   => 1,
898   },
899
900   {
901     'key'         => 'email-to-voice_domain',
902     'section'     => 'email_to_voice_services',
903     'description' => 'The domain name that phone numbers will be attached to for sending email to voice emails via a 3rd party email to voice service.  You will get this domain from your email to voice service provider.  This is utilized on the email customer page or when using the email to voice billing event action.  There you will be able to select the phone number for the email to voice service.',
904     'type'        => 'text',
905     'per_agent'   => 1,
906   },
907
908   {
909     'key'         => 'next-bill-ignore-time',
910     'section'     => 'billing',
911     'description' => 'Ignore the time portion of next bill dates when billing, matching anything from 00:00:00 to 23:59:59 on the billing day.',
912     'type'        => 'checkbox',
913   },
914   
915   {
916     'key'         => 'business-onlinepayment',
917     'section'     => 'credit_cards',
918     '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.  For more detailed information and examples see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Administration:Real-time_Processing">real-time credit card processing documentation</a>.',
919     'type'        => 'textarea',
920   },
921
922   {
923     'key'         => 'business-onlinepayment-ach',
924     'section'     => 'e-checks',
925     '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.',
926     'type'        => 'textarea',
927   },
928
929   {
930     'key'         => 'business-onlinepayment-namespace',
931     'section'     => 'credit_cards',
932     'description' => 'Specifies which perl module namespace (which group of collection routines) is used by default.',
933     'type'        => 'select',
934     'select_hash' => [
935                        'Business::OnlinePayment' => 'Direct API (Business::OnlinePayment)',
936                        'Business::OnlineThirdPartyPayment' => 'Web API (Business::ThirdPartyPayment)',
937                      ],
938   },
939
940   {
941     'key'         => 'business-onlinepayment-description',
942     'section'     => 'credit_cards',
943     '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 - not available in all situations)',
944     'type'        => 'text',
945   },
946
947   {
948     'key'         => 'business-onlinepayment-email-override',
949     'section'     => 'credit_cards',
950     'description' => 'Email address used instead of customer email address when submitting a BOP transaction.',
951     'type'        => 'text',
952   },
953
954   {
955     'key'         => 'business-onlinepayment-email_customer',
956     'section'     => 'credit_cards',
957     'description' => 'Controls the "email_customer" flag used by some Business::OnlinePayment processors to enable customer receipts.',
958     'type'        => 'checkbox',
959   },
960
961   {
962     'key'         => 'business-onlinepayment-test_transaction',
963     'section'     => 'credit_cards',
964     'description' => 'Turns on the Business::OnlinePayment test_transaction flag.  Note that not all gateway modules support this flag; if yours does not, transactions will still be sent live.',
965     'type'        => 'checkbox',
966   },
967
968   {
969     'key'         => 'business-onlinepayment-currency',
970     'section'     => 'credit_cards',
971     'description' => 'Currency parameter for Business::OnlinePayment transactions.',
972     'type'        => 'select',
973     'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD ARS ) ],
974   },
975
976   {
977     'key'         => 'business-onlinepayment-verification',
978     'section'     => 'credit_cards',
979     'description' => 'Run a $1 authorization (followed by a void) to verify new credit card information.',
980     'type'        => 'checkbox',
981   },
982
983   {
984     'key'         => 'currency',
985     'section'     => 'localization',
986     'description' => 'Main accounting currency',
987     'type'        => 'select',
988     'select_enum' => [ '', qw( USD AUD CAD DKK EUR GBP ILS JPY NZD XAF ARS ) ],
989   },
990
991   {
992     'key'         => 'currencies',
993     'section'     => 'localization',
994     'description' => 'Additional accepted currencies',
995     'type'        => 'select-sub',
996     'multiple'    => 1,
997     'options_sub' => sub { 
998                            map { $_ => code2currency($_) } all_currency_codes();
999                          },
1000     'sort_sub'    => sub ($$) { $_[0] cmp $_[1]; },
1001     'option_sub'  => sub { code2currency(shift); },
1002   },
1003
1004   {
1005     'key'         => 'business-batchpayment-test_transaction',
1006     'section'     => 'credit_cards',
1007     'description' => 'Turns on the Business::BatchPayment test_mode flag.  Note that not all gateway modules support this flag; if yours does not, using the batch gateway will fail.',
1008     'type'        => 'checkbox',
1009   },
1010
1011   {
1012     'key'         => 'countrydefault',
1013     'section'     => 'localization',
1014     'description' => 'Default two-letter country code (if not supplied, the default is `US\')',
1015     'type'        => 'text',
1016   },
1017
1018   {
1019     'key'         => 'date_format',
1020     'section'     => 'localization',
1021     'description' => 'Format for displaying dates',
1022     'type'        => 'select',
1023     'select_hash' => [
1024                        '%m/%d/%Y' => 'MM/DD/YYYY',
1025                        '%d/%m/%Y' => 'DD/MM/YYYY',
1026                        '%Y/%m/%d' => 'YYYY/MM/DD',
1027                        '%e %b %Y' => 'DD Mon YYYY',
1028                      ],
1029     'per_locale'  => 1,
1030   },
1031
1032   {
1033     'key'         => 'date_format_long',
1034     'section'     => 'localization',
1035     'description' => 'Verbose format for displaying dates',
1036     'type'        => 'select',
1037     'select_hash' => [
1038                        '%b %o, %Y' => 'Mon DDth, YYYY',
1039                        '%e %b %Y'  => 'DD Mon YYYY',
1040                        '%m/%d/%Y'  => 'MM/DD/YYYY',
1041                        '%d/%m/%Y'  => 'DD/MM/YYYY',
1042                        '%Y/%m/%d'  => 'YYYY/MM/DD',
1043                      ],
1044     'per_locale'  => 1,
1045   },
1046
1047   {
1048     'key'         => 'deleterefunds',
1049     'section'     => 'billing',
1050     'description' => 'Enable deletion of unclosed refunds.  Be very careful!  Only delete refunds that were data-entry errors, not adjustments.',
1051     'type'        => 'checkbox',
1052   },
1053
1054   {
1055     'key'         => 'dirhash',
1056     'section'     => 'shell',
1057     '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>',
1058     'type'        => 'text',
1059   },
1060
1061   {
1062     'key'         => 'disable_cust_attachment',
1063     'section'     => 'notes',
1064     'description' => 'Disable customer file attachments',
1065     'type'        => 'checkbox',
1066   },
1067
1068   {
1069     'key'         => 'max_attachment_size',
1070     'section'     => 'notes',
1071     'description' => 'Maximum size for customer file attachments (leave blank for unlimited)',
1072     'type'        => 'text',
1073   },
1074
1075   {
1076     'key'         => 'disable_customer_referrals',
1077     'section'     => 'customer_fields',
1078     'description' => 'Disable new customer-to-customer referrals in the web interface',
1079     'type'        => 'checkbox',
1080   },
1081
1082   {
1083     'key'         => 'editreferrals',
1084     'section'     => 'customer_fields',
1085     'description' => 'Enable advertising source modification for existing customers',
1086     'type'        => 'checkbox',
1087   },
1088
1089   {
1090     'key'         => 'emailinvoiceonly',
1091     'section'     => 'invoice_email',
1092     'description' => 'Disables postal mail invoices',
1093     'type'        => 'checkbox',
1094   },
1095
1096   {
1097     'key'         => 'disablepostalinvoicedefault',
1098     'section'     => 'invoicing',
1099     '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>.',
1100     'type'        => 'checkbox',
1101   },
1102
1103   {
1104     'key'         => 'emailinvoiceauto',
1105     'section'     => 'invoice_email',
1106     'description' => 'Automatically adds new accounts to the email invoice list',
1107     'type'        => 'checkbox',
1108   },
1109
1110   {
1111     'key'         => 'emailinvoiceautoalways',
1112     'section'     => 'invoice_email',
1113     'description' => 'Automatically adds new accounts to the email invoice list even when the list contains email addresses',
1114     'type'        => 'checkbox',
1115   },
1116
1117   {
1118     'key'         => 'emailinvoice-apostrophe',
1119     'section'     => 'invoice_email',
1120     'description' => 'Allows the apostrophe (single quote) character in the email addresses in the email invoice list.',
1121     'type'        => 'checkbox',
1122   },
1123
1124   {
1125     'key'         => 'svc_acct-ip_addr',
1126     'section'     => 'services',
1127     'description' => 'Enable IP address management on login services like for broadband services.',
1128     'type'        => 'checkbox',
1129   },
1130
1131   {
1132     'key'         => 'exclude_ip_addr',
1133     'section'     => 'services',
1134     'description' => 'Exclude these from the list of available IP addresses. (One per line)',
1135     'type'        => 'textarea',
1136   },
1137   
1138   {
1139     'key'         => 'auto_router',
1140     'section'     => 'wireless_broadband',
1141     'description' => 'Automatically choose the correct router/block based on supplied ip address when possible while provisioning broadband services',
1142     'type'        => 'checkbox',
1143   },
1144   
1145   {
1146     'key'         => 'hidecancelledpackages',
1147     'section'     => 'cancellation',
1148     'description' => 'Prevent cancelled packages from showing up in listings (though they will still be in the database)',
1149     'type'        => 'checkbox',
1150   },
1151
1152   {
1153     'key'         => 'hidecancelledcustomers',
1154     'section'     => 'cancellation',
1155     'description' => 'Prevent customers with only cancelled packages from showing up in listings (though they will still be in the database)',
1156     'type'        => 'checkbox',
1157   },
1158
1159   {
1160     'key'         => 'home',
1161     'section'     => 'shell',
1162     'description' => 'For new users, prefixed to username to create a directory name.  Should have a leading but not a trailing slash.',
1163     'type'        => 'text',
1164   },
1165
1166   {
1167     'key'         => 'invoice_from',
1168     'section'     => 'important',
1169     'description' => 'Return address on email invoices ("user@domain" only)',
1170     'type'        => 'text',
1171     'per_agent'   => 1,
1172     'validate'    => $validate_email,
1173   },
1174
1175   {
1176     'key'         => 'invoice_from_name',
1177     'section'     => 'invoice_email',
1178     'description' => 'Return name on email invoices (set address in invoice_from)',
1179     'type'        => 'text',
1180     'per_agent'   => 1,
1181     'validate'    => sub { (($_[0] =~ /[^[:alnum:][:space:]]/) && ($_[0] !~ /^\".*\"$/))
1182                            ? 'Invalid name.  Use quotation marks around names that contain punctuation.'
1183                            : '' }
1184   },
1185
1186   {
1187     'key'         => 'quotation_from',
1188     'section'     => 'quotations',
1189     'description' => 'Return address on email quotations',
1190     'type'        => 'text',
1191     'per_agent'   => 1,
1192   },
1193
1194
1195   {
1196     'key'         => 'invoice_subject',
1197     'section'     => 'invoice_email',
1198     'description' => 'Subject: header on email invoices.  Defaults to "Invoice".  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
1199     'type'        => 'text',
1200     'per_agent'   => 1,
1201     'per_locale'  => 1,
1202   },
1203
1204   {
1205     'key'         => 'quotation_subject',
1206     'section'     => 'quotations',
1207     'description' => 'Subject: header on email quotations.  Defaults to "Quotation".', #  The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
1208     'type'        => 'text',
1209     #'per_agent'   => 1,
1210     'per_locale'  => 1,
1211   },
1212
1213   {
1214     'key'         => 'invoice_usesummary',
1215     'section'     => 'invoicing',
1216     'description' => 'Indicates that html and latex invoices should be in summary style and make use of invoice_latexsummary.',
1217     'type'        => 'checkbox',
1218   },
1219
1220   {
1221     'key'         => 'invoice_template',
1222     'section'     => 'invoice_templates',
1223     '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:3:Documentation:Administration#Plaintext_invoice_templates">billing documentation</a> for details.',
1224     'type'        => 'textarea',
1225   },
1226
1227   {
1228     'key'         => 'invoice_html',
1229     'section'     => 'invoice_templates',
1230     'description' => 'HTML template for invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Administration#HTML_invoice_templates">billing documentation</a> for details.',
1231
1232     'type'        => 'textarea',
1233   },
1234
1235   {
1236     'key'         => 'quotation_html',
1237     'section'     => 'quotations',
1238     'description' => 'HTML template for quotations.',
1239
1240     'type'        => 'textarea',
1241   },
1242
1243   {
1244     'key'         => 'invoice_htmlnotes',
1245     'section'     => 'invoice_templates',
1246     'description' => 'Notes section for HTML invoices.  Defaults to the same data in invoice_latexnotes if not specified.',
1247     'type'        => 'textarea',
1248     'per_agent'   => 1,
1249     'per_locale'  => 1,
1250   },
1251
1252   {
1253     'key'         => 'invoice_htmlfooter',
1254     'section'     => 'invoice_templates',
1255     'description' => 'Footer for HTML invoices.  Defaults to the same data in invoice_latexfooter if not specified.',
1256     'type'        => 'textarea',
1257     'per_agent'   => 1,
1258     'per_locale'  => 1,
1259   },
1260
1261   {
1262     'key'         => 'invoice_htmlsummary',
1263     'section'     => 'invoice_templates',
1264     'description' => 'Summary initial page for HTML invoices.',
1265     'type'        => 'textarea',
1266     'per_agent'   => 1,
1267     'per_locale'  => 1,
1268   },
1269
1270   {
1271     'key'         => 'invoice_htmlreturnaddress',
1272     'section'     => 'invoice_templates',
1273     'description' => 'Return address for HTML invoices.  Defaults to the same data in invoice_latexreturnaddress if not specified.',
1274     'type'        => 'textarea',
1275     'per_locale'  => 1,
1276   },
1277
1278   {
1279     'key'         => 'invoice_htmlwatermark',
1280     'section'     => 'invoice_templates',
1281     'description' => 'Watermark for HTML invoices. Appears in a semitransparent positioned DIV overlaid on the main invoice container.',
1282     'type'        => 'textarea',
1283     'per_agent'   => 1,
1284     'per_locale'  => 1,
1285   },
1286
1287   {
1288     'key'         => 'invoice_latex',
1289     'section'     => 'invoice_templates',
1290     'description' => 'Optional LaTeX template for typeset PostScript invoices.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Administration#Typeset_.28LaTeX.29_invoice_templates">billing documentation</a> for details.',
1291     'type'        => 'textarea',
1292   },
1293
1294   {
1295     'key'         => 'quotation_latex',
1296     'section'     => 'quotations',
1297     'description' => 'LaTeX template for typeset PostScript quotations.',
1298     'type'        => 'textarea',
1299   },
1300
1301   {
1302     'key'         => 'invoice_latextopmargin',
1303     'section'     => 'invoicing',
1304     'description' => 'Optional LaTeX invoice topmargin setting. Include units.',
1305     'type'        => 'text',
1306     'per_agent'   => 1,
1307     'validate'    => sub { shift =~
1308                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1309                              ? '' : 'Invalid LaTex length';
1310                          },
1311   },
1312
1313   {
1314     'key'         => 'invoice_latexheadsep',
1315     'section'     => 'invoicing',
1316     'description' => 'Optional LaTeX invoice headsep setting. Include units.',
1317     'type'        => 'text',
1318     'per_agent'   => 1,
1319     'validate'    => sub { shift =~
1320                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1321                              ? '' : 'Invalid LaTex length';
1322                          },
1323   },
1324
1325   {
1326     'key'         => 'invoice_latexaddresssep',
1327     'section'     => 'invoicing',
1328     'description' => 'Optional LaTeX invoice separation between invoice header
1329 and customer address. Include units.',
1330     'type'        => 'text',
1331     'per_agent'   => 1,
1332     'validate'    => sub { shift =~
1333                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1334                              ? '' : 'Invalid LaTex length';
1335                          },
1336   },
1337
1338   {
1339     'key'         => 'invoice_latextextheight',
1340     'section'     => 'invoicing',
1341     'description' => 'Optional LaTeX invoice textheight setting. Include units.',
1342     'type'        => 'text',
1343     'per_agent'   => 1,
1344     'validate'    => sub { shift =~
1345                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1346                              ? '' : 'Invalid LaTex length';
1347                          },
1348   },
1349
1350   {
1351     'key'         => 'invoice_latexnotes',
1352     'section'     => 'invoice_templates',
1353     'description' => 'Notes section for LaTeX typeset PostScript invoices.',
1354     'type'        => 'textarea',
1355     'per_agent'   => 1,
1356     'per_locale'  => 1,
1357   },
1358
1359   {
1360     'key'         => 'quotation_latexnotes',
1361     'section'     => 'quotations',
1362     'description' => 'Notes section for LaTeX typeset PostScript quotations.',
1363     'type'        => 'textarea',
1364     'per_agent'   => 1,
1365     'per_locale'  => 1,
1366   },
1367
1368   {
1369     'key'         => 'invoice_latexfooter',
1370     'section'     => 'invoice_templates',
1371     'description' => 'Footer for LaTeX typeset PostScript invoices.',
1372     'type'        => 'textarea',
1373     'per_agent'   => 1,
1374     'per_locale'  => 1,
1375   },
1376
1377   {
1378     'key'         => 'invoice_latexsummary',
1379     'section'     => 'invoice_templates',
1380     'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
1381     'type'        => 'textarea',
1382     'per_agent'   => 1,
1383     'per_locale'  => 1,
1384   },
1385
1386   {
1387     'key'         => 'invoice_latexcoupon',
1388     'section'     => 'invoice_templates',
1389     'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
1390     'type'        => 'textarea',
1391     'per_agent'   => 1,
1392     'per_locale'  => 1,
1393   },
1394
1395   {
1396     'key'         => 'invoice_latexextracouponspace',
1397     'section'     => 'invoicing',
1398     'description' => 'Optional LaTeX invoice textheight space to reserve for a tear off coupon.  Include units.  Default is 2.7 inches.',
1399     'type'        => 'text',
1400     'per_agent'   => 1,
1401     'validate'    => sub { shift =~
1402                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1403                              ? '' : 'Invalid LaTex length';
1404                          },
1405   },
1406
1407   {
1408     'key'         => 'invoice_latexcouponfootsep',
1409     'section'     => 'invoicing',
1410     'description' => 'Optional LaTeX invoice separation between bottom of coupon address and footer. Include units. Default is 0.2 inches.',
1411     'type'        => 'text',
1412     'per_agent'   => 1,
1413     'validate'    => sub { shift =~
1414                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1415                              ? '' : 'Invalid LaTex length';
1416                          },
1417   },
1418
1419   {
1420     'key'         => 'invoice_latexcouponamountenclosedsep',
1421     'section'     => 'invoicing',
1422     'description' => 'Optional LaTeX invoice separation between total due and amount enclosed line. Include units. Default is 2.25 em.',
1423     'type'        => 'text',
1424     'per_agent'   => 1,
1425     'validate'    => sub { shift =~
1426                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1427                              ? '' : 'Invalid LaTex length';
1428                          },
1429   },
1430   {
1431     'key'         => 'invoice_latexcoupontoaddresssep',
1432     'section'     => 'invoicing',
1433     'description' => 'Optional LaTeX invoice separation between invoice data and the address (usually invoice_latexreturnaddress).  Include units. Default is 1 inch.',
1434     'type'        => 'text',
1435     'per_agent'   => 1,
1436     'validate'    => sub { shift =~
1437                              /^-?\d*\.?\d+(in|mm|cm|pt|em|ex|pc|bp|dd|cc|sp)$/
1438                              ? '' : 'Invalid LaTex length';
1439                          },
1440   },
1441
1442   {
1443     'key'         => 'invoice_latexreturnaddress',
1444     'section'     => 'invoice_templates',
1445     'description' => 'Return address for LaTeX typeset PostScript invoices.',
1446     'type'        => 'textarea',
1447   },
1448
1449   {
1450     'key'         => 'invoice_latexverticalreturnaddress',
1451     'section'     => 'deprecated',
1452     'description' => 'Deprecated.  With old invoice_latex template, places the return address under the company logo rather than beside it.',
1453     'type'        => 'checkbox',
1454     'per_agent'   => 1,
1455   },
1456
1457   {
1458     'key'         => 'invoice_latexcouponaddcompanytoaddress',
1459     'section'     => 'invoicing',
1460     'description' => 'Add the company name to the To address on the remittance coupon because the return address does not contain it.',
1461     'type'        => 'checkbox',
1462     'per_agent'   => 1,
1463   },
1464
1465   {
1466     'key'         => 'invoice_latexsmallfooter',
1467     'section'     => 'invoice_templates',
1468     'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
1469     'type'        => 'textarea',
1470     'per_agent'   => 1,
1471     'per_locale'  => 1,
1472   },
1473
1474   {
1475     'key'         => 'invoice_latexwatermark',
1476     'section'     => 'invocie_templates',
1477     'description' => 'Watermark for LaTeX invoices. See "texdoc background" for information on what this can contain. The content itself should be enclosed in braces, optionally followed by a comma and any formatting options.',
1478     'type'        => 'textarea',
1479     'per_agent'   => 1,
1480     'per_locale'  => 1,
1481   },
1482
1483   {
1484     'key'         => 'invoice_email_pdf',
1485     'section'     => 'invoice_email',
1486     'description' => 'Send PDF invoice as an attachment to emailed invoices.  By default, includes the HTML invoice as the email body, unless invoice_email_pdf_note is set.',
1487     'type'        => 'checkbox'
1488   },
1489
1490   {
1491     'key'         => 'quotation_email_pdf',
1492     'section'     => 'quotations',
1493     'description' => 'Send PDF quotations as an attachment to emailed quotations.  By default, includes the HTML quotation as the email body, unless quotation_email_pdf_note is set.',
1494     'type'        => 'checkbox'
1495   },
1496
1497   {
1498     'key'         => 'invoice_email_pdf_msgnum',
1499     'section'     => 'invoice_email',
1500     'description' => 'Message template to send as the text and HTML part of PDF invoices. If not selected, a text and HTML version of the invoice will be sent.',
1501     %msg_template_options,
1502   },
1503
1504   {
1505     'key'         => 'invoice_email_pdf_note',
1506     'section'     => 'invoice_email',
1507     'description' => 'If defined, this text will replace the default HTML invoice as the body of emailed PDF invoices.',
1508     'type'        => 'textarea'
1509   },
1510
1511   {
1512     'key'         => 'quotation_email_pdf_note',
1513     'section'     => 'quotations',
1514     'description' => 'If defined, this text will replace the default HTML quotation as the body of emailed PDF quotations.',
1515     'type'        => 'textarea'
1516   },
1517
1518   {
1519     'key'         => 'quotation_disable_after_days',
1520     'section'     => 'quotations',
1521     'description' => 'The number of days, if set, after which a non-converted quotation will be automatically disabled.',
1522     'type'        => 'text'
1523   },
1524
1525   {
1526     'key'         => 'invoice_print_pdf',
1527     'section'     => 'printing',
1528     'description' => 'For all invoice print operations, store postal invoices for download in PDF format rather than printing them directly.',
1529     'type'        => 'checkbox',
1530   },
1531
1532   {
1533     'key'         => 'invoice_print_pdf-spoolagent',
1534     'section'     => 'printing',
1535     'description' => 'Store postal invoices PDF downloads in per-agent spools.',
1536     'type'        => 'checkbox',
1537   },
1538
1539   {
1540     'key'         => 'invoice_print_pdf-duplex',
1541     'section'     => 'printing',
1542     'description' => 'Insert blank pages so that spooled invoices are each an even number of pages.  Use this for double-sided printing.',
1543     'type'        => 'checkbox',
1544   },
1545
1546   { 
1547     'key'         => 'invoice_default_terms',
1548     'section'     => 'invoicing',
1549     'description' => 'Optional default invoice term, used to calculate a due date printed on invoices.  WARNING: If you do not want to change the terms on existing invoices, do not change this after going live.',
1550     'type'        => 'select',
1551     'per_agent'   => 1,
1552     'select_enum' => \@invoice_terms,
1553   },
1554
1555   { 
1556     'key'         => 'invoice_show_prior_due_date',
1557     'section'     => 'invoice_balances',
1558     'description' => 'Show previous invoice due dates when showing prior balances.  Default is to show invoice date.',
1559     'type'        => 'checkbox',
1560   },
1561
1562   { 
1563     'key'         => 'invoice_omit_due_date',
1564     'section'     => 'invoice_balances',
1565     'description' => 'Omit the "Please pay by (date)" from invoices.',
1566     'type'        => 'checkbox',
1567     'per_agent'   => 1,
1568   },
1569
1570   { 
1571     'key'         => 'invoice_pay_by_msg',
1572     'section'     => 'invoice_balances',
1573     'description' => 'Test of the "Please pay by (date)" message.  Include [_1] to indicate the date, for example: "Please pay by [_1]"',
1574     'type'        => 'text',
1575     'per_agent'   => 1,
1576   },
1577
1578   { 
1579     'key'         => 'invoice_sections',
1580     'section'     => 'invoicing',
1581     'description' => 'Split invoice into sections and label according to package category when enabled.',
1582     'type'        => 'checkbox',
1583     'per_agent'   => 1,
1584   },
1585
1586   { 
1587     'key'         => 'invoice_include_aging',
1588     'section'     => 'invoice_balances',
1589     'description' => 'Show an aging line after the prior balance section.  Only valid when invoice_sections is enabled.',
1590     'type'        => 'checkbox',
1591   },
1592
1593   {
1594     'key'         => 'invoice_sections_method',
1595     'section'     => 'invoicing',
1596     'description' => 'How to group line items on multi-section invoices.',
1597     'type'        => 'select',
1598     'select_enum' => [ qw(category location) ],
1599   },
1600
1601   {
1602     'key'         => 'summary_subtotals_method',
1603     'section'     => 'invoicing',
1604     'description' => 'How to group line items when calculating summary subtotals.  By default, it will be the same method used for grouping invoice sections.',
1605     'type'        => 'select',
1606     'select_enum' => [ qw(category location) ],
1607   },
1608
1609   #quotations seem broken-ish with sections ATM?
1610   #{ 
1611   #  'key'         => 'quotation_sections',
1612   #  'section'     => 'invoicing',
1613   #  'description' => 'Split quotations into sections and label according to package category when enabled.',
1614   #  'type'        => 'checkbox',
1615   #  'per_agent'   => 1,
1616   #},
1617
1618   {
1619     'key'         => 'usage_class_summary',
1620     'section'     => 'telephony_invoicing',
1621     'description' => 'On invoices, summarize total usage by usage class in a separate section',
1622     'type'        => 'checkbox',
1623   },
1624
1625   { 
1626     'key'         => 'usage_class_as_a_section',
1627     'section'     => 'telephony_invoicing',
1628     'description' => 'On invoices, split usage into sections and label according to usage class name when enabled.  Only valid when invoice_sections is enabled.',
1629     'type'        => 'checkbox',
1630   },
1631
1632   { 
1633     'key'         => 'phone_usage_class_summary',
1634     'section'     => 'telephony_invoicing',
1635     'description' => 'On invoices, summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
1636     'type'        => 'checkbox',
1637   },
1638
1639   { 
1640     'key'         => 'svc_phone_sections',
1641     'section'     => 'telephony_invoicing',
1642     'description' => 'On invoices, create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',
1643     'type'        => 'checkbox',
1644   },
1645
1646   {
1647     'key'         => 'finance_pkgclass',
1648     'section'     => 'billing',
1649     'description' => 'The default package class for late fee charges, used if the fee event does not specify a package class itself.',
1650     'type'        => 'select-pkg_class',
1651   },
1652
1653   { 
1654     'key'         => 'separate_usage',
1655     'section'     => 'telephony_invoicing',
1656     'description' => 'On invoices, split the rated call usage into a separate line from the recurring charges.',
1657     'type'        => 'checkbox',
1658   },
1659
1660   {
1661     'key'         => 'payment_receipt',
1662     'section'     => 'notification',
1663     'description' => 'Send payment receipts.',
1664     'type'        => 'checkbox',
1665     'per_agent'   => 1,
1666     'agent_bool'  => 1,
1667   },
1668
1669   {
1670     'key'         => 'payment_receipt_statement_mode',
1671     'section'     => 'notification',
1672     'description' => 'Automatic payments will cause a post-payment statement to be sent to the customer. Select the invoice mode to use for this statement. If unspecified, it will use the "_statement" versions of invoice configuration settings, and have the notice name "Statement".',
1673     %invoice_mode_options,
1674   },
1675
1676   {
1677     'key'         => 'payment_receipt_msgnum',
1678     'section'     => 'notification',
1679     'description' => 'Template to use for manual payment receipts.',
1680     %msg_template_options,
1681   },
1682   
1683   {
1684     'key'         => 'payment_receipt_from',
1685     'section'     => 'notification',
1686     'description' => 'From: address for payment receipts, if not specified in the template.',
1687     'type'        => 'text',
1688     'per_agent'   => 1,
1689   },
1690
1691   {
1692     'key'         => 'payment_receipt-trigger',
1693     'section'     => 'notification',
1694     'description' => 'When payment receipts are triggered.  Defaults to when payment is made.',
1695     'type'        => 'select',
1696     'select_hash' => [
1697                        'cust_pay'          => 'When payment is made.',
1698                        'cust_bill_pay_pkg' => 'When payment is applied.',
1699                      ],
1700     'per_agent'   => 1,
1701   },
1702
1703   {
1704     'key'         => 'refund_receipt_msgnum',
1705     'section'     => 'notification',
1706     'description' => 'Template to use for manual refund receipts.',
1707     %msg_template_options,
1708   },
1709   
1710   {
1711     'key'         => 'trigger_export_insert_on_payment',
1712     'section'     => 'payments',
1713     'description' => 'Enable exports on payment application.',
1714     'type'        => 'checkbox',
1715   },
1716
1717   {
1718     'key'         => 'lpr',
1719     'section'     => 'printing',
1720     'description' => 'Print command for paper invoices, for example `lpr -h\'',
1721     'type'        => 'text',
1722     'per_agent'   => 1,
1723   },
1724
1725   {
1726     'key'         => 'lpr-postscript_prefix',
1727     'section'     => 'printing',
1728     'description' => 'Raw printer commands prepended to the beginning of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1729     'type'        => 'text',
1730   },
1731
1732   {
1733     'key'         => 'lpr-postscript_suffix',
1734     'section'     => 'printing',
1735     'description' => 'Raw printer commands added to the end of postscript print jobs (evaluated as a double-quoted perl string - backslash escapes are available)',
1736     'type'        => 'text',
1737   },
1738
1739   {
1740     'key'         => 'papersize',
1741     'section'     => 'printing',
1742     'description' => 'Invoice paper size.  Default is "letter" (U.S. standard).  The LaTeX template must be configured to match this size.',
1743     'type'        => 'select',
1744     'select_enum' => [ qw(letter a4) ],
1745   },
1746
1747   {
1748     'key'         => 'money_char',
1749     'section'     => 'localization',
1750     'description' => 'Currency symbol - defaults to `$\'',
1751     'type'        => 'text',
1752   },
1753
1754   {
1755     'key'         => 'defaultrecords',
1756     'section'     => 'BIND',
1757     'description' => 'DNS entries to add automatically when creating a domain',
1758     'type'        => 'editlist',
1759     'editlist_parts' => [ { type=>'text' },
1760                           { type=>'immutable', value=>'IN' },
1761                           { type=>'select',
1762                             select_enum => {
1763                               map { $_=>$_ }
1764                                   #@{ FS::domain_record->rectypes }
1765                                   qw(A AAAA CNAME MX NS PTR SPF SRV TXT)
1766                             },
1767                           },
1768                           { type=> 'text' }, ],
1769   },
1770
1771   {
1772     'key'         => 'passwordmin',
1773     'section'     => 'password',
1774     'description' => 'Minimum password length (default 6)',
1775     'type'        => 'text',
1776   },
1777
1778   {
1779     'key'         => 'passwordmax',
1780     'section'     => 'password',
1781     'description' => 'Maximum password length (default 12) (don\'t set this over 12 if you need to import or export crypt() passwords)',
1782     'type'        => 'text',
1783   },
1784
1785   {
1786     'key'         => 'sip_passwordmin',
1787     'section'     => 'telephony',
1788     'description' => 'Minimum SIP password length (default 6)',
1789     'type'        => 'text',
1790   },
1791
1792   {
1793     'key'         => 'sip_passwordmax',
1794     'section'     => 'telephony',
1795     'description' => 'Maximum SIP password length (default 80)',
1796     'type'        => 'text',
1797   },
1798
1799
1800   {
1801     'key'         => 'password-noampersand',
1802     'section'     => 'password',
1803     'description' => 'Disallow ampersands in passwords',
1804     'type'        => 'checkbox',
1805   },
1806
1807   {
1808     'key'         => 'password-noexclamation',
1809     'section'     => 'password',
1810     'description' => 'Disallow exclamations in passwords (Not setting this could break old text Livingston or Cistron Radius servers)',
1811     'type'        => 'checkbox',
1812   },
1813
1814   {
1815     'key'         => 'default-password-encoding',
1816     'section'     => 'password',
1817     'description' => 'Default storage format for passwords',
1818     'type'        => 'select',
1819     'select_hash' => [
1820       'plain'       => 'Plain text',
1821       'crypt-des'   => 'Unix password (DES encrypted)',
1822       'crypt-md5'   => 'Unix password (MD5 digest)',
1823       'ldap-plain'  => 'LDAP (plain text)',
1824       'ldap-crypt'  => 'LDAP (DES encrypted)',
1825       'ldap-md5'    => 'LDAP (MD5 digest)',
1826       'ldap-sha1'   => 'LDAP (SHA1 digest)',
1827       'legacy'      => 'Legacy mode',
1828     ],
1829   },
1830
1831   {
1832     'key'         => 'referraldefault',
1833     'section'     => 'customer_fields',
1834     'description' => 'Default referral, specified by refnum',
1835     'type'        => 'select-sub',
1836     'options_sub' => sub { require FS::Record;
1837                            require FS::part_referral;
1838                            map { $_->refnum => $_->referral }
1839                                FS::Record::qsearch( 'part_referral', 
1840                                                     { 'disabled' => '' }
1841                                                   );
1842                          },
1843     'option_sub'  => sub { require FS::Record;
1844                            require FS::part_referral;
1845                            my $part_referral = FS::Record::qsearchs(
1846                              'part_referral', { 'refnum'=>shift } );
1847                            $part_referral ? $part_referral->referral : '';
1848                          },
1849   },
1850
1851   {
1852     'key'         => 'maxsearchrecordsperpage',
1853     'section'     => 'reporting',
1854     'description' => 'If set, number of search records to return per page.',
1855     'type'        => 'text',
1856   },
1857
1858   {
1859     'key'         => 'cust_main-packages-num_per_page',
1860     'section'     => 'packages',
1861     'description' => 'Number of packages to display per page on customer view (default 10).',
1862     'type'        => 'text',
1863   },
1864
1865   {
1866     'key'         => 'disable_maxselect',
1867     'section'     => 'reporting',
1868     'description' => 'Prevent changing the number of records per page.',
1869     'type'        => 'checkbox',
1870   },
1871
1872   {
1873     'key'         => 'session-start',
1874     'section'     => 'deprecated',
1875     'description' => 'Used to define 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.',
1876     'type'        => 'text',
1877   },
1878
1879   {
1880     'key'         => 'session-stop',
1881     'section'     => 'deprecated',
1882     'description' => 'Used to define 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.',
1883     'type'        => 'text',
1884   },
1885
1886   {
1887     'key'         => 'shells',
1888     'section'     => 'shell',
1889     '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.',
1890     'type'        => 'textarea',
1891   },
1892
1893   {
1894     'key'         => 'showpasswords',
1895     'section'     => 'password',
1896     'description' => 'Display unencrypted user passwords in the backend (employee) web interface',
1897     'type'        => 'checkbox',
1898   },
1899
1900   {
1901     'key'         => 'report-showpasswords',
1902     'section'     => 'password',
1903     'description' => 'This is a terrible idea.  Do not enable it.  STRONGLY NOT RECOMMENDED.  Enables display of passwords on services reports.',
1904     'type'        => 'checkbox',
1905   },
1906
1907   {
1908     'key'         => 'signupurl',
1909     'section'     => 'signup',
1910     '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:3:Documentation:Self-Service_Installation">signup server CGI</a>, the customer view screen will display a customized link to self-signup with the appropriate customer as referral',
1911     'type'        => 'text',
1912   },
1913
1914   {
1915     'key'         => 'smtpmachine',
1916     'section'     => 'important',
1917     'description' => 'SMTP relay for Freeside\'s outgoing mail',
1918     'type'        => 'text',
1919   },
1920
1921   {
1922     'key'         => 'smtp-username',
1923     'section'     => 'notification',
1924     'description' => 'Optional SMTP username for Freeside\'s outgoing mail',
1925     'type'        => 'text',
1926   },
1927
1928   {
1929     'key'         => 'smtp-password',
1930     'section'     => 'notification',
1931     'description' => 'Optional SMTP password for Freeside\'s outgoing mail',
1932     'type'        => 'text',
1933   },
1934
1935   {
1936     'key'         => 'smtp-encryption',
1937     'section'     => 'notification',
1938     'description' => 'Optional SMTP encryption method.  The STARTTLS methods require smtp-username and smtp-password to be set.',
1939     'type'        => 'select',
1940     'select_hash' => [ '25'           => 'None (port 25)',
1941                        '25-starttls'  => 'STARTTLS (port 25)',
1942                        '587-starttls' => 'STARTTLS / submission (port 587)',
1943                        '465-tls'      => 'SMTPS (SSL) (port 465)',
1944                      ],
1945   },
1946
1947   {
1948     'key'         => 'soadefaultttl',
1949     'section'     => 'BIND',
1950     'description' => 'SOA default TTL for new domains.',
1951     'type'        => 'text',
1952   },
1953
1954   {
1955     'key'         => 'soaemail',
1956     'section'     => 'BIND',
1957     'description' => 'SOA email for new domains, in BIND form (`.\' instead of `@\'), with trailing `.\'',
1958     'type'        => 'text',
1959   },
1960
1961   {
1962     'key'         => 'soaexpire',
1963     'section'     => 'BIND',
1964     'description' => 'SOA expire for new domains',
1965     'type'        => 'text',
1966   },
1967
1968   {
1969     'key'         => 'soamachine',
1970     'section'     => 'BIND',
1971     'description' => 'SOA machine for new domains, with trailing `.\'',
1972     'type'        => 'text',
1973   },
1974
1975   {
1976     'key'         => 'soarefresh',
1977     'section'     => 'BIND',
1978     'description' => 'SOA refresh for new domains',
1979     'type'        => 'text',
1980   },
1981
1982   {
1983     'key'         => 'soaretry',
1984     'section'     => 'BIND',
1985     'description' => 'SOA retry for new domains',
1986     'type'        => 'text',
1987   },
1988
1989   {
1990     'key'         => 'statedefault',
1991     'section'     => 'localization',
1992     'description' => 'Default state or province (if not supplied, the default is `CA\')',
1993     'type'        => 'text',
1994   },
1995
1996   {
1997     'key'         => 'unsuspend_balance',
1998     'section'     => 'suspension',
1999     'description' => 'Enables the automatic unsuspension of suspended packages when a customer\'s balance due is at or below the specified amount after a payment or credit',
2000     'type'        => 'select',
2001     'select_enum' => [ 
2002       '', 'Zero', 'Latest invoice charges', 'Charges not past due'
2003     ],
2004   },
2005
2006   {
2007     'key'         => 'unsuspend-always_adjust_next_bill_date',
2008     'section'     => 'suspension',
2009     '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.',
2010     'type'        => 'checkbox',
2011   },
2012
2013   {
2014     'key'         => 'usernamemin',
2015     'section'     => 'username',
2016     'description' => 'Minimum username length (default 2)',
2017     'type'        => 'text',
2018   },
2019
2020   {
2021     'key'         => 'usernamemax',
2022     'section'     => 'username',
2023     'description' => 'Maximum username length',
2024     'type'        => 'text',
2025   },
2026
2027   {
2028     'key'         => 'username-ampersand',
2029     'section'     => 'username',
2030     'description' => 'Allow the ampersand character (&amp;) 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.',
2031     'type'        => 'checkbox',
2032   },
2033
2034   {
2035     'key'         => 'username-letter',
2036     'section'     => 'username',
2037     'description' => 'Usernames must contain at least one letter',
2038     'type'        => 'checkbox',
2039     'per_agent'   => 1,
2040   },
2041
2042   {
2043     'key'         => 'username-letterfirst',
2044     'section'     => 'username',
2045     'description' => 'Usernames must start with a letter',
2046     'type'        => 'checkbox',
2047   },
2048
2049   {
2050     'key'         => 'username-noperiod',
2051     'section'     => 'username',
2052     'description' => 'Disallow periods in usernames',
2053     'type'        => 'checkbox',
2054   },
2055
2056   {
2057     'key'         => 'username-nounderscore',
2058     'section'     => 'username',
2059     'description' => 'Disallow underscores in usernames',
2060     'type'        => 'checkbox',
2061   },
2062
2063   {
2064     'key'         => 'username-nodash',
2065     'section'     => 'username',
2066     'description' => 'Disallow dashes in usernames',
2067     'type'        => 'checkbox',
2068   },
2069
2070   {
2071     'key'         => 'username-uppercase',
2072     'section'     => 'username',
2073     'description' => 'Allow uppercase characters in usernames.  Not recommended for use with FreeRADIUS with MySQL backend, which is case-insensitive by default.',
2074     'type'        => 'checkbox',
2075     'per_agent'   => 1,
2076   },
2077
2078   { 
2079     'key'         => 'username-percent',
2080     'section'     => 'username',
2081     'description' => 'Allow the percent character (%) in usernames.',
2082     'type'        => 'checkbox',
2083   },
2084
2085   { 
2086     'key'         => 'username-colon',
2087     'section'     => 'username',
2088     'description' => 'Allow the colon character (:) in usernames.',
2089     'type'        => 'checkbox',
2090   },
2091
2092   { 
2093     'key'         => 'username-slash',
2094     'section'     => 'username',
2095     'description' => 'Allow the slash character (/) in usernames.  When using, make sure to set "Home directory" to fixed and blank in all svc_acct service definitions.',
2096     'type'        => 'checkbox',
2097   },
2098
2099   { 
2100     'key'         => 'username-equals',
2101     'section'     => 'username',
2102     'description' => 'Allow the equal sign character (=) in usernames.',
2103     'type'        => 'checkbox',
2104   },
2105
2106   {
2107     'key'         => 'google_maps_api_key',
2108     'section'     => 'addresses',
2109     'description' => 'API key for google maps.  This must be set for map and directions links to work.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_top">Getting a Google Maps API Key</a>',
2110     'type'        => 'text',
2111   },
2112
2113   {
2114     'key'         => 'company_physical_address',
2115     'section'     => 'addresses',
2116     'description' => 'Your physical company address, for use in supplying google map directions, defaults to company_address',
2117     'type'        => 'textarea',
2118     'per_agent'   => 1,
2119   },
2120
2121   {
2122     'key'         => 'show_ship_company',
2123     'section'     => 'addresses',
2124     'description' => 'Turns on display/collection of a "service company name" field for customers.',
2125     'type'        => 'checkbox',
2126   },
2127
2128   {
2129     'key'         => 'show_ss',
2130     'section'     => 'e-checks',
2131     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
2132     'type'        => 'checkbox',
2133   },
2134
2135   {
2136     'key'         => 'unmask_ss',
2137     'section'     => 'e-checks',
2138     'description' => "Don't mask social security numbers in the web interface.",
2139     'type'        => 'checkbox',
2140   },
2141
2142   {
2143     'key'         => 'show_stateid',
2144     'section'     => 'e-checks',
2145     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
2146     'type'        => 'checkbox',
2147   },
2148
2149   {
2150     'key'         => 'national_id-country',
2151     'section'     => 'localization',
2152     'description' => 'Track a national identification number, for specific countries.',
2153     'type'        => 'select',
2154     'select_enum' => [ '', 'MY' ],
2155   },
2156
2157   {
2158     'key'         => 'show_bankstate',
2159     'section'     => 'e-checks',
2160     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
2161     'type'        => 'checkbox',
2162   },
2163
2164   { 
2165     'key'         => 'agent_defaultpkg',
2166     'section'     => 'packages',
2167     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
2168     'type'        => 'checkbox',
2169   },
2170
2171   {
2172     'key'         => 'legacy_link',
2173     'section'     => 'UI',
2174     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
2175     'type'        => 'checkbox',
2176   },
2177
2178   {
2179     'key'         => 'legacy_link-steal',
2180     'section'     => 'UI',
2181     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
2182     'type'        => 'checkbox',
2183   },
2184
2185   {
2186     'key'         => 'queue_dangerous_controls',
2187     'section'     => 'development',
2188     '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.',
2189     'type'        => 'checkbox',
2190   },
2191
2192   {
2193     'key'         => 'security_phrase',
2194     'section'     => 'password',
2195     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
2196     'type'        => 'checkbox',
2197   },
2198
2199   {
2200     'key'         => 'locale',
2201     'section'     => 'localization',
2202     'description' => 'Default locale',
2203     'type'        => 'select-sub',
2204     'options_sub' => sub {
2205       map { $_ => FS::Locales->description($_) } FS::Locales->locales;
2206     },
2207     'option_sub'  => sub {
2208       FS::Locales->description(shift)
2209     },
2210   },
2211
2212   {
2213     'key'         => 'signup_server-payby',
2214     'section'     => 'signup',
2215     'description' => 'Acceptable payment types for self-signup',
2216     'type'        => 'selectmultiple',
2217     'select_enum' => [ qw(CARD DCRD CHEK DCHK PREPAY PPAL ) ], # BILL COMP) ],
2218   },
2219
2220   {
2221     'key'         => 'selfservice-payment_gateway',
2222     'section'     => 'deprecated',
2223     'description' => '(no longer supported) Force the use of this payment gateway for self-service.',
2224     %payment_gateway_options,
2225   },
2226
2227   {
2228     'key'         => 'selfservice-save_unchecked',
2229     'section'     => 'self-service',
2230     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
2231     'type'        => 'checkbox',
2232   },
2233
2234   {
2235     'key'         => 'default_agentnum',
2236     'section'     => 'customer_fields',
2237     'description' => 'Default agent for the backoffice',
2238     'type'        => 'select-agent',
2239   },
2240
2241   {
2242     'key'         => 'signup_server-default_agentnum',
2243     'section'     => 'signup',
2244     'description' => 'Default agent for self-signup',
2245     'type'        => 'select-agent',
2246   },
2247
2248   {
2249     'key'         => 'signup_server-default_refnum',
2250     'section'     => 'signup',
2251     'description' => 'Default advertising source for self-signup',
2252     'type'        => 'select-sub',
2253     'options_sub' => sub { require FS::Record;
2254                            require FS::part_referral;
2255                            map { $_->refnum => $_->referral }
2256                                FS::Record::qsearch( 'part_referral', 
2257                                                     { 'disabled' => '' }
2258                                                   );
2259                          },
2260     'option_sub'  => sub { require FS::Record;
2261                            require FS::part_referral;
2262                            my $part_referral = FS::Record::qsearchs(
2263                              'part_referral', { 'refnum'=>shift } );
2264                            $part_referral ? $part_referral->referral : '';
2265                          },
2266   },
2267
2268   {
2269     'key'         => 'signup_server-default_pkgpart',
2270     'section'     => 'signup',
2271     'description' => 'Default package for self-signup',
2272     'type'        => 'select-part_pkg',
2273   },
2274
2275   {
2276     'key'         => 'signup_server-default_svcpart',
2277     'section'     => 'signup',
2278     'description' => 'Default service definition for self-signup - only necessary for services that trigger special provisioning widgets (such as DID provisioning or domain selection).',
2279     'type'        => 'select-part_svc',
2280   },
2281
2282   {
2283     'key'         => 'signup_server-default_domsvc',
2284     'section'     => 'signup',
2285     'description' => 'If specified, the default domain svcpart for self-signup (useful when domain is set to selectable choice).',
2286     'type'        => 'text',
2287   },
2288
2289   {
2290     'key'         => 'signup_server-mac_addr_svcparts',
2291     'section'     => 'signup',
2292     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
2293     'type'        => 'select-part_svc',
2294     'multiple'    => 1,
2295   },
2296
2297   {
2298     'key'         => 'signup_server-nomadix',
2299     'section'     => 'deprecated',
2300     'description' => 'Signup page Nomadix integration',
2301     'type'        => 'checkbox',
2302   },
2303
2304   {
2305     'key'         => 'signup_server-service',
2306     'section'     => 'signup',
2307     'description' => 'Service for the self-signup - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
2308     'type'        => 'select',
2309     'select_hash' => [
2310                        'svc_acct'  => 'Account (svc_acct)',
2311                        'svc_phone' => 'Phone number (svc_phone)',
2312                        'svc_pbx'   => 'PBX (svc_pbx)',
2313                        'none'      => 'None - package only',
2314                      ],
2315   },
2316   
2317   {
2318     'key'         => 'signup_server-prepaid-template-custnum',
2319     'section'     => 'signup',
2320     'description' => 'When self-signup is used with prepaid cards and customer info is not required for signup, the contact/address info will be copied from this customer, if specified',
2321     'type'        => 'text',
2322   },
2323
2324   {
2325     'key'         => 'signup_server-terms_of_service',
2326     'section'     => 'signup',
2327     'description' => 'Terms of Service for self-signup.  May contain HTML.',
2328     'type'        => 'textarea',
2329     'per_agent'   => 1,
2330   },
2331
2332   {
2333     'key'         => 'selfservice_server-base_url',
2334     'section'     => 'self-service',
2335     'description' => 'Base URL for the self-service web interface - necessary for some widgets to find their way, including retrieval of non-US state information and phone number provisioning.',
2336     'type'        => 'text',
2337   },
2338
2339   {
2340     'key'         => 'show-msgcat-codes',
2341     'section'     => 'development',
2342     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
2343     'type'        => 'checkbox',
2344   },
2345
2346   {
2347     'key'         => 'signup_server-realtime',
2348     'section'     => 'signup',
2349     'description' => 'Run billing for self-signups immediately, and do not provision accounts which subsequently have a balance.',
2350     'type'        => 'checkbox',
2351   },
2352
2353   {
2354     'key'         => 'signup_server-classnum2',
2355     'section'     => 'signup',
2356     'description' => 'Package Class for first optional purchase',
2357     'type'        => 'select-pkg_class',
2358   },
2359
2360   {
2361     'key'         => 'signup_server-classnum3',
2362     'section'     => 'signup',
2363     'description' => 'Package Class for second optional purchase',
2364     'type'        => 'select-pkg_class',
2365   },
2366
2367   {
2368     'key'         => 'signup_server-third_party_as_card',
2369     'section'     => 'signup',
2370     'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
2371     'type'        => 'checkbox',
2372   },
2373
2374   {
2375     'key'         => 'selfservice-xmlrpc',
2376     'section'     => 'API',
2377     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
2378     'type'        => 'checkbox',
2379   },
2380
2381   {
2382     'key'         => 'selfservice-timeout',
2383     'section'     => 'self-service',
2384     'description' => 'Timeout for the self-service login cookie, in seconds.  Defaults to 1 hour.',
2385     'type'        => 'text',
2386   },
2387
2388   {
2389     'key'         => 'backend-realtime',
2390     'section'     => 'billing',
2391     'description' => 'Run billing for backend signups immediately.',
2392     'type'        => 'checkbox',
2393   },
2394
2395   {
2396     'key'         => 'decline_msgnum',
2397     'section'     => 'notification',
2398     'description' => 'Template to use for credit card and electronic check decline messages.',
2399     %msg_template_options,
2400   },
2401
2402   {
2403     'key'         => 'emaildecline',
2404     'section'     => 'notification',
2405     'description' => 'Enable emailing of credit card and electronic check decline notices.',
2406     'type'        => 'checkbox',
2407     'per_agent'   => 1,
2408   },
2409
2410   {
2411     'key'         => 'emaildecline-exclude',
2412     'section'     => 'notification',
2413     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
2414     'type'        => 'textarea',
2415     'per_agent'   => 1,
2416   },
2417
2418   {
2419     'key'         => 'cancel_msgnum',
2420     'section'     => 'cancellation',
2421     'description' => 'Template to use for cancellation emails.',
2422     %msg_template_options,
2423   },
2424
2425   {
2426     'key'         => 'emailcancel',
2427     'section'     => 'cancellation',
2428     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
2429     'type'        => 'checkbox',
2430     'per_agent'   => 1,
2431   },
2432
2433   {
2434     'key'         => 'bill_usage_on_cancel',
2435     'section'     => 'cancellation',
2436     'description' => 'Enable automatic generation of an invoice for usage when a package is cancelled.  Not all packages can do this.  Usage data must already be available.',
2437     'type'        => 'checkbox',
2438   },
2439
2440   {
2441     'key'         => 'cancel_msgnum-referring_cust-pkg_class',
2442     'section'     => 'cancellation',
2443     'description' => 'Enable cancellation messages to the referring customer for these package classes.',
2444     'type'        => 'select-pkg_class',
2445     'multiple'    => 1,
2446   },
2447
2448   {
2449     'key'         => 'cancel_msgnum-referring_cust',
2450     'section'     => 'cancellation',
2451     'description' => 'Template to use for cancellation emails sent to the referring customer.',
2452     %msg_template_options,
2453   },
2454
2455   {
2456     'key'         => 'require_cardname',
2457     'section'     => 'credit_cards',
2458     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
2459     'type'        => 'checkbox',
2460   },
2461
2462   {
2463     'key'         => 'enable_taxclasses',
2464     'section'     => 'taxation',
2465     'description' => 'Enable per-package tax classes',
2466     'type'        => 'checkbox',
2467   },
2468
2469   {
2470     'key'         => 'require_taxclasses',
2471     'section'     => 'taxation',
2472     'description' => 'Require a taxclass to be entered for every package',
2473     'type'        => 'checkbox',
2474   },
2475
2476   {
2477     'key'         => 'tax_data_vendor',
2478     'section'     => 'taxation',
2479     'description' => 'Tax data vendor you are using.',
2480     'type'        => 'select',
2481     'select_enum' => [ '', 'cch', 'billsoft', 'avalara', 'suretax', 'compliance_solutions' ],
2482   },
2483
2484   {
2485     'key'         => 'taxdatadirectdownload',
2486     'section'     => 'taxation',
2487     'description' => 'Enable downloading tax data directly from CCH. at least three lines: URL, username, and password.j',
2488     'type'        => 'textarea',
2489   },
2490
2491   {
2492     'key'         => 'ignore_incalculable_taxes',
2493     'section'     => 'taxation',
2494     'description' => 'Prefer to invoice without tax over not billing at all',
2495     'type'        => 'checkbox',
2496   },
2497
2498   {
2499     'key'         => 'billsoft-company_code',
2500     'section'     => 'taxation',
2501     'description' => 'Billsoft (AvaTax for Communications) tax service company code (3 letters)',
2502     'type'        => 'text',
2503   },
2504
2505   {
2506     'key'         => 'billsoft-taxconfig',
2507     'section'     => 'taxation',
2508     'description' => 'Billsoft tax configuration flags. Four lines: Facilities, Franchise, Regulated, Business Class. See the Avalara documentation for instructions on setting these flags.',
2509     'type'        => 'textarea',
2510   },
2511
2512   {
2513     'key'         => 'avalara-taxconfig',
2514     'section'     => 'taxation',
2515     'description' => 'Avalara tax service configuration. Four lines: company code, account number, license key, test mode (1 to enable).',
2516     'type'        => 'textarea',
2517   },
2518
2519   {
2520     'key'         => 'suretax-hostname',
2521     'section'     => 'taxation',
2522     'description' => 'SureTax server name; defaults to the test server.',
2523     'type'        => 'text',
2524   },
2525
2526   {
2527     'key'         => 'suretax-client_number',
2528     'section'     => 'taxation',
2529     'description' => 'SureTax tax service client ID.',
2530     'type'        => 'text',
2531   },
2532   {
2533     'key'         => 'suretax-validation_key',
2534     'section'     => 'taxation',
2535     'description' => 'SureTax validation key (UUID).',
2536     'type'        => 'text',
2537   },
2538   {
2539     'key'         => 'suretax-business_unit',
2540     'section'     => 'taxation',
2541     'description' => 'SureTax client business unit name; optional.',
2542     'type'        => 'text',
2543     'per_agent'   => 1,
2544   },
2545   {
2546     'key'         => 'suretax-regulatory_code',
2547     'section'     => 'taxation',
2548     'description' => 'SureTax client regulatory status.',
2549     'type'        => 'select',
2550     'select_enum' => [ '', 'ILEC', 'IXC', 'CLEC', 'VOIP', 'ISP', 'Wireless' ],
2551     'per_agent'   => 1,
2552   },
2553
2554   {
2555     'key'         => 'compliance_solutions-access_code',
2556     'section'     => 'taxation',
2557     'description' => 'Access code for <a href="http://csilongwood.com/">Compliance Solutions</a> tax rating service',
2558     'type'        => 'text',
2559   },
2560   {
2561     'key'         => 'compliance_solutions-regulatory_code',
2562     'section'     => 'taxation',
2563     'description' => 'Compliance Solutions regulatory status.',
2564     'type'        => 'select',
2565     'select_enum' => [ '', 'ILEC', 'IXC', 'CLEC', 'VOIP', 'ISP', 'Wireless' ],
2566     'per_agent'   => 1,
2567   },
2568
2569   {
2570     'key'         => 'welcome_msgnum',
2571     'section'     => 'deprecated',
2572     'description' => 'Deprecated; use a billing event instead.  Used to be the template to use for welcome messages when a svc_acct record is created.',
2573     %msg_template_options,
2574   },
2575   
2576   {
2577     'key'         => 'svc_acct_welcome_exclude',
2578     'section'     => 'deprecated',
2579     'description' => 'Deprecated; use a billing event instead.  A list of svc_acct services for which no welcome email is to be sent.',
2580     'type'        => 'select-part_svc',
2581     'multiple'    => 1,
2582   },
2583
2584   {
2585     'key'         => 'welcome_letter',
2586     'section'     => 'notification',
2587     '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>',
2588     'type'        => 'textarea',
2589   },
2590
2591   {
2592     'key'         => 'threshold_warning_msgnum',
2593     'section'     => 'notification',
2594     'description' => 'Template to use for warning messages sent to the customer email invoice destination(s) when a svc_acct record has its usage drop below a threshold.  Extra substitutions available: $column, $amount, $threshold',
2595     %msg_template_options,
2596   },
2597
2598   {
2599     'key'         => 'payby',
2600     'section'     => 'payments',
2601     'description' => 'Available payment types.',
2602     'type'        => 'selectmultiple',
2603     'select_enum' => [ qw(CARD DCRD CHEK DCHK) ], #BILL CASH WEST MCRD MCHK PPAL) ],
2604   },
2605
2606   {
2607     'key'         => 'banned_pay-pad',
2608     'section'     => 'credit_cards',
2609     'description' => 'Padding for encrypted storage of banned credit card hashes.  If you already have new-style SHA512 entries in the banned_pay table, do not change as this will invalidate the old entries.',
2610     'type'        => 'text',
2611   },
2612
2613   {
2614     'key'         => 'payby-default',
2615     'section'     => 'deprecated',
2616     'description' => 'Deprecated; in 4.x there is no longer the concept of a single "payment type".  Used to indicate the default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2617     'type'        => 'select',
2618     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK BILL CASH WEST MCRD PPAL COMP HIDE) ],
2619   },
2620
2621   {
2622     'key'         => 'require_cash_deposit_info',
2623     'section'     => 'payments',
2624     'description' => 'When recording cash payments, display bank deposit information fields.',
2625     'type'        => 'checkbox',
2626   },
2627
2628   {
2629     'key'         => 'svc_acct-notes',
2630     'section'     => 'deprecated',
2631     'description' => 'Extra HTML to be displayed on the Account View screen.',
2632     'type'        => 'textarea',
2633   },
2634
2635   {
2636     'key'         => 'radius-password',
2637     'section'     => 'RADIUS',
2638     'description' => 'RADIUS attribute for plain-text passwords.',
2639     'type'        => 'select',
2640     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2641   },
2642
2643   {
2644     'key'         => 'radius-ip',
2645     'section'     => 'RADIUS',
2646     'description' => 'RADIUS attribute for IP addresses.',
2647     'type'        => 'select',
2648     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2649   },
2650
2651   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2652   {
2653     'key'         => 'radius-chillispot-max',
2654     'section'     => 'RADIUS',
2655     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2656     'type'        => 'checkbox',
2657   },
2658
2659   {
2660     'key'         => 'radius-canopy',
2661     'section'     => 'RADIUS',
2662     'description' => 'Enable RADIUS attributes for Cambium (formerly Motorola) Canopy (Motorola-Canopy-Gateway).',
2663     'type'        => 'checkbox',
2664   },
2665
2666   {
2667     'key'         => 'svc_broadband-radius',
2668     'section'     => 'RADIUS',
2669     'description' => 'Enable RADIUS groups for broadband services.',
2670     'type'        => 'checkbox',
2671   },
2672
2673   {
2674     'key'         => 'svc_acct-alldomains',
2675     'section'     => 'services',
2676     '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.',
2677     'type'        => 'checkbox',
2678   },
2679
2680   {
2681     'key'         => 'dump-localdest',
2682     'section'     => 'backup',
2683     'description' => 'Destination for local database dumps (full path)',
2684     'type'        => 'text',
2685   },
2686
2687   {
2688     'key'         => 'dump-scpdest',
2689     'section'     => 'backup',
2690     'description' => 'Destination for scp database dumps: user@host:/path',
2691     'type'        => 'text',
2692   },
2693
2694   {
2695     'key'         => 'dump-pgpid',
2696     'section'     => 'backup',
2697     '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.",
2698     'type'        => 'text',
2699   },
2700
2701   {
2702     'key'         => 'credit_card-recurring_billing_flag',
2703     'section'     => 'credit_cards',
2704     'description' => 'This controls when the system passes the "recurring_billing" flag on credit card transactions.  If supported by your processor (and the Business::OnlinePayment processor module), passing the flag indicates this is a recurring transaction and may turn off the CVV requirement. ',
2705     'type'        => 'select',
2706     'select_hash' => [
2707                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2708                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, regardless of previous charges on the card.',
2709                      ],
2710   },
2711
2712   {
2713     'key'         => 'credit_card-recurring_billing_acct_code',
2714     'section'     => 'credit_cards',
2715     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2716     'type'        => 'checkbox',
2717   },
2718
2719   {
2720     'key'         => 'cvv-save',
2721     'section'     => 'credit_cards',
2722     'description' => 'NOT RECOMMENDED.  Saves CVV2 information after the initial transaction for the selected credit card types.  Enabling this option is almost certainly in violation of your merchant agreement(s), so please check them carefully before enabling this option for any credit card types.',
2723     'type'        => 'selectmultiple',
2724     'select_enum' => \@card_types,
2725   },
2726
2727   {
2728     'key'         => 'signup-require_cvv',
2729     'section'     => 'credit_cards',
2730     'description' => 'Require CVV for credit card signup.',
2731     'type'        => 'checkbox',
2732   },
2733
2734   {
2735     'key'         => 'backoffice-require_cvv',
2736     'section'     => 'credit_cards',
2737     'description' => 'Require CVV for manual credit card entry.',
2738     'type'        => 'checkbox',
2739   },
2740
2741   {
2742     'key'         => 'selfservice-onfile_require_cvv',
2743     'section'     => 'credit_cards',
2744     'description' => 'Require CVV for on-file credit card during self-service payments.',
2745     'type'        => 'checkbox',
2746   },
2747
2748   {
2749     'key'         => 'selfservice-require_cvv',
2750     'section'     => 'credit_cards',
2751     'description' => 'Require CVV for credit card self-service payments, except for cards on-file.',
2752     'type'        => 'checkbox',
2753   },
2754
2755   {
2756     'key'         => 'manual_process-pkgpart',
2757     'section'     => 'payments',
2758     'description' => 'Package to add to each manual credit card and ACH payment entered by employees from the backend.  WARNING: Although recently permitted to US merchants in general, specific consumer protection laws may prohibit or restrict this practice in California, Colorado, Connecticut, Florda, Kansas, Maine, Massachusetts, New York, Oklahome, and Texas. Surcharging is also generally prohibited in most countries outside the US, AU and UK.',
2759     'type'        => 'select-part_pkg',
2760     'per_agent'   => 1,
2761   },
2762
2763   {
2764     'key'         => 'manual_process-display',
2765     'section'     => 'payments',
2766     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2767     'type'        => 'select',
2768     'select_hash' => [
2769                        'add'      => 'Add fee to amount entered',
2770                        'subtract' => 'Subtract fee from amount entered',
2771                      ],
2772   },
2773
2774   {
2775     'key'         => 'manual_process-skip_first',
2776     'section'     => 'payments',
2777     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2778     'type'        => 'checkbox',
2779   },
2780
2781   {
2782     'key'         => 'selfservice_immutable-package',
2783     'section'     => 'self-service',
2784     'description' => 'Disable package changes in self-service interface.',
2785     'type'        => 'checkbox',
2786     'per_agent'   => 1,
2787   },
2788
2789   {
2790     'key'         => 'selfservice_hide-usage',
2791     'section'     => 'self-service',
2792     'description' => 'Hide usage data in self-service interface.',
2793     'type'        => 'checkbox',
2794     'per_agent'   => 1,
2795   },
2796
2797   {
2798     'key'         => 'selfservice_process-pkgpart',
2799     'section'     => 'payments',
2800     'description' => 'Package to add to each manual credit card and ACH payment entered by the customer themselves in the self-service interface.  Enabling this option may be in violation of your merchant agreement(s), so please check it(/them) carefully before enabling this option.',
2801     'type'        => 'select-part_pkg',
2802     'per_agent'   => 1,
2803   },
2804
2805   {
2806     'key'         => 'selfservice_process-display',
2807     'section'     => 'payments',
2808     'description' => 'When using selfservice_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2809     'type'        => 'select',
2810     'select_hash' => [
2811                        'add'      => 'Add fee to amount entered',
2812                        'subtract' => 'Subtract fee from amount entered',
2813                      ],
2814   },
2815
2816   {
2817     'key'         => 'selfservice_process-skip_first',
2818     'section'     => 'payments',
2819     'description' => "When using selfservice_process-pkgpart, omit the fee if it is the customer's first payment.",
2820     'type'        => 'checkbox',
2821   },
2822
2823 #  {
2824 #    'key'         => 'auto_process-pkgpart',
2825 #    'section'     => 'billing',
2826 #    'description' => 'Package to add to each automatic credit card and ACH payment processed by billing events.  Enabling this option may be in violation of your merchant agreement(s), so please check them carefully before enabling this option.',
2827 #    'type'        => 'select-part_pkg',
2828 #  },
2829 #
2830 ##  {
2831 ##    'key'         => 'auto_process-display',
2832 ##    'section'     => 'billing',
2833 ##    'description' => 'When using auto_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2834 ##    'type'        => 'select',
2835 ##    'select_hash' => [
2836 ##                       'add'      => 'Add fee to amount entered',
2837 ##                       'subtract' => 'Subtract fee from amount entered',
2838 ##                     ],
2839 ##  },
2840 #
2841 #  {
2842 #    'key'         => 'auto_process-skip_first',
2843 #    'section'     => 'billing',
2844 #    'description' => "When using auto_process-pkgpart, omit the fee if it is the customer's first payment.",
2845 #    'type'        => 'checkbox',
2846 #  },
2847
2848   {
2849     'key'         => 'allow_negative_charges',
2850     'section'     => 'deprecated',
2851     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2852     'type'        => 'checkbox',
2853   },
2854   {
2855       'key'         => 'auto_unset_catchall',
2856       'section'     => 'cancellation',
2857       '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.',
2858       'type'        => 'checkbox',
2859   },
2860
2861   {
2862     'key'         => 'system_usernames',
2863     'section'     => 'username',
2864     '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.',
2865     'type'        => 'textarea',
2866   },
2867
2868   {
2869     'key'         => 'cust_pkg-change_svcpart',
2870     'section'     => 'packages',
2871     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
2872     'type'        => 'checkbox',
2873   },
2874
2875   {
2876     'key'         => 'cust_pkg-change_pkgpart-bill_now',
2877     'section'     => 'RADIUS',
2878     'description' => "When changing packages, bill the new package immediately.  Useful for prepaid situations with RADIUS where an Expiration attribute based on the package must be present at all times.",
2879     'type'        => 'checkbox',
2880   },
2881
2882   {
2883     'key'         => 'disable_autoreverse',
2884     'section'     => 'BIND',
2885     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
2886     'type'        => 'checkbox',
2887   },
2888
2889   {
2890     'key'         => 'svc_www-enable_subdomains',
2891     'section'     => 'services',
2892     'description' => 'Enable selection of specific subdomains for virtual host creation.',
2893     'type'        => 'checkbox',
2894   },
2895
2896   {
2897     'key'         => 'svc_www-usersvc_svcpart',
2898     'section'     => 'services',
2899     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
2900     'type'        => 'select-part_svc',
2901     'multiple'    => 1,
2902   },
2903
2904   {
2905     'key'         => 'selfservice_server-primary_only',
2906     'section'     => 'self-service',
2907     'description' => 'Only allow primary accounts to access self-service functionality.',
2908     'type'        => 'checkbox',
2909   },
2910
2911   {
2912     'key'         => 'selfservice_server-phone_login',
2913     'section'     => 'self-service',
2914     'description' => 'Allow login to self-service with phone number and PIN.',
2915     'type'        => 'checkbox',
2916   },
2917
2918   {
2919     'key'         => 'selfservice_server-single_domain',
2920     'section'     => 'self-service',
2921     'description' => 'If specified, only use this one domain for self-service access.',
2922     'type'        => 'text',
2923   },
2924
2925   {
2926     'key'         => 'selfservice_server-login_svcpart',
2927     'section'     => 'self-service',
2928     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
2929     'type'        => 'select-part_svc',
2930     'multiple'    => 1,
2931   },
2932
2933   {
2934     'key'         => 'selfservice-svc_forward_svcpart',
2935     'section'     => 'self-service',
2936     'description' => 'Service for self-service forward editing.',
2937     'type'        => 'select-part_svc',
2938   },
2939
2940   {
2941     'key'         => 'selfservice-password_reset_verification',
2942     'section'     => 'self-service',
2943     'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
2944     'type'        => 'select',
2945     'select_hash' => [ '' => 'Password reset disabled',
2946                        'email' => 'Click on a link in email',
2947                        'paymask,amount,zip' => 'Click on a link in email, and also verify with credit card (or bank account) last 4 digits, payment amount and zip code.  Note: Do not use if you have multi-customer contacts, as they will be unable to reset their passwords.',
2948                      ],
2949   },
2950
2951   {
2952     'key'         => 'selfservice-password_reset_hours',
2953     'section'     => 'self-service',
2954     'description' => 'Numbers of hours an email password reset is valid.  Defaults to 24.',
2955     'type'        => 'text',
2956   },
2957
2958   {
2959     'key'         => 'selfservice-password_reset_msgnum',
2960     'section'     => 'self-service',
2961     'description' => 'Template to use for password reset emails.',
2962     %msg_template_options,
2963   },
2964
2965   {
2966     'key'         => 'selfservice-password_change_oldpass',
2967     'section'     => 'self-service',
2968     'description' => 'Require old password to be entered again for password changes (in addition to being logged in), at the API level.',
2969     'type'        => 'checkbox',
2970   },
2971
2972   {
2973     'key'         => 'selfservice-hide_invoices-taxclass',
2974     'section'     => 'self-service',
2975     'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
2976     'type'        => 'text',
2977   },
2978
2979   {
2980     'key'         => 'selfservice-recent-did-age',
2981     'section'     => 'self-service',
2982     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
2983     'type'        => 'text',
2984   },
2985
2986   {
2987     'key'         => 'selfservice_server-view-wholesale',
2988     'section'     => 'self-service',
2989     'description' => 'If enabled, use a wholesale package view in the self-service.',
2990     'type'        => 'checkbox',
2991   },
2992   
2993   {
2994     'key'         => 'selfservice-agent_signup',
2995     'section'     => 'self-service',
2996     'description' => 'Allow agent signup via self-service.',
2997     'type'        => 'checkbox',
2998   },
2999
3000   {
3001     'key'         => 'selfservice-agent_signup-agent_type',
3002     'section'     => 'self-service',
3003     'description' => 'Agent type when allowing agent signup via self-service.',
3004     'type'        => 'select-sub',
3005     'options_sub' => sub { require FS::Record;
3006                            require FS::agent_type;
3007                            map { $_->typenum => $_->atype }
3008                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
3009                          },
3010     'option_sub'  => sub { require FS::Record;
3011                            require FS::agent_type;
3012                            my $agent_type = FS::Record::qsearchs(
3013                              'agent_type', { 'typenum'=>shift }
3014                            );
3015                            $agent_type ? $agent_type->atype : '';
3016                          },
3017   },
3018
3019   {
3020     'key'         => 'selfservice-agent_login',
3021     'section'     => 'self-service',
3022     'description' => 'Allow agent login via self-service.',
3023     'type'        => 'checkbox',
3024   },
3025
3026   {
3027     'key'         => 'selfservice-self_suspend_reason',
3028     'section'     => 'self-service',
3029     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
3030     'type'        => 'select-sub',
3031     #false laziness w/api_credit_reason
3032     'options_sub' => sub { require FS::Record;
3033                            require FS::reason;
3034                            my $type = qsearchs('reason_type', 
3035                              { class => 'S' }) 
3036                               or return ();
3037                            map { $_->reasonnum => $_->reason }
3038                                FS::Record::qsearch('reason', 
3039                                  { reason_type => $type->typenum } 
3040                                );
3041                          },
3042     'option_sub'  => sub { require FS::Record;
3043                            require FS::reason;
3044                            my $reason = FS::Record::qsearchs(
3045                              'reason', { 'reasonnum' => shift }
3046                            );
3047                            $reason ? $reason->reason : '';
3048                          },
3049
3050     'per_agent'   => 1,
3051   },
3052
3053   {
3054     'key'         => 'card_refund-days',
3055     'section'     => 'credit_cards',
3056     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
3057     'type'        => 'text',
3058   },
3059
3060   {
3061     'key'         => 'agent-showpasswords',
3062     'section'     => 'deprecated',
3063     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
3064     'type'        => 'checkbox',
3065   },
3066
3067   {
3068     'key'         => 'global_unique-username',
3069     'section'     => 'username',
3070     '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.',
3071     'type'        => 'select',
3072     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
3073   },
3074
3075   {
3076     'key'         => 'global_unique-phonenum',
3077     'section'     => 'telephony',
3078     'description' => 'Global phone number uniqueness control: none (usual setting - check countrycode+phonenumun uniqueness per exports), or countrycode+phonenum (all countrycode+phonenum 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.',
3079     'type'        => 'select',
3080     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
3081   },
3082
3083   {
3084     'key'         => 'global_unique-pbx_title',
3085     'section'     => 'telephony',
3086     'description' => 'Global phone number uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
3087     'type'        => 'select',
3088     'select_enum' => [ 'enabled', 'disabled' ],
3089   },
3090
3091   {
3092     'key'         => 'global_unique-pbx_id',
3093     'section'     => 'telephony',
3094     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
3095     'type'        => 'select',
3096     'select_enum' => [ 'enabled', 'disabled' ],
3097   },
3098
3099   {
3100     'key'         => 'svc_external-skip_manual',
3101     'section'     => 'UI',
3102     '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).',
3103     'type'        => 'checkbox',
3104   },
3105
3106   {
3107     'key'         => 'svc_external-display_type',
3108     'section'     => 'UI',
3109     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
3110     'type'        => 'select',
3111     'select_enum' => [ 'generic', 'artera_turbo', ],
3112   },
3113
3114   {
3115     'key'         => 'ticket_system',
3116     'section'     => 'ticketing',
3117     '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:3:Documentation:RT_Installation">integrated ticketing installation instructions</a>).   <b>RT_External</b> accesses an external RT installation in a separate database (local or remote).',
3118     'type'        => 'select',
3119     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
3120     'select_enum' => [ '', qw(RT_Internal RT_External) ],
3121   },
3122
3123   {
3124     'key'         => 'network_monitoring_system',
3125     'section'     => 'network_monitoring',
3126     'description' => 'Networking monitoring system (NMS) integration.  <b>Torrus_Internal</b> uses the built-in Torrus network monitoring system (see the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:3:Documentation:Torrus_Installation">installation instructions</a>).',
3127     'type'        => 'select',
3128     'select_enum' => [ '', qw(Torrus_Internal) ],
3129   },
3130
3131   {
3132     'key'         => 'nms-auto_add-svc_ips',
3133     'section'     => 'network_monitoring',
3134     'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
3135     'type'        => 'selectmultiple',
3136     'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
3137   },
3138
3139   {
3140     'key'         => 'nms-auto_add-community',
3141     'section'     => 'network_monitoring',
3142     'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
3143     'type'        => 'text',
3144   },
3145
3146   {
3147     'key'         => 'pingd-interval',
3148     'section'     => 'network_monitoring',
3149     'description' => 'Run ping scans of broadband services at this interval.',
3150     'type'        => 'select',
3151     'select_hash' => [ ''     => '',
3152                        60     => '1 min',
3153                        300    => '5 min',
3154                        600    => '10 min',
3155                        1800   => '30 min',
3156                        3600   => '1 hour',
3157                        14400  => '4 hours',
3158                        28800  => '8 hours',
3159                        86400  => '1 day',
3160                      ],
3161   },
3162
3163   {
3164     'key'         => 'ticket_system-default_queueid',
3165     'section'     => 'ticketing',
3166     'description' => 'Default queue used when creating new customer tickets.',
3167     'type'        => 'select-sub',
3168     'options_sub' => sub {
3169                            my $conf = new FS::Conf;
3170                            if ( $conf->config('ticket_system') ) {
3171                              eval "use FS::TicketSystem;";
3172                              die $@ if $@;
3173                              FS::TicketSystem->queues();
3174                            } else {
3175                              ();
3176                            }
3177                          },
3178     'option_sub'  => sub { 
3179                            my $conf = new FS::Conf;
3180                            if ( $conf->config('ticket_system') ) {
3181                              eval "use FS::TicketSystem;";
3182                              die $@ if $@;
3183                              FS::TicketSystem->queue(shift);
3184                            } else {
3185                              '';
3186                            }
3187                          },
3188   },
3189
3190   {
3191     'key'         => 'ticket_system-force_default_queueid',
3192     'section'     => 'ticketing',
3193     'description' => 'Disallow queue selection when creating new tickets from customer view.',
3194     'type'        => 'checkbox',
3195   },
3196
3197   {
3198     'key'         => 'ticket_system-selfservice_queueid',
3199     'section'     => 'ticketing',
3200     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
3201     #false laziness w/above
3202     'type'        => 'select-sub',
3203     'options_sub' => sub {
3204                            my $conf = new FS::Conf;
3205                            if ( $conf->config('ticket_system') ) {
3206                              eval "use FS::TicketSystem;";
3207                              die $@ if $@;
3208                              FS::TicketSystem->queues();
3209                            } else {
3210                              ();
3211                            }
3212                          },
3213     'option_sub'  => sub { 
3214                            my $conf = new FS::Conf;
3215                            if ( $conf->config('ticket_system') ) {
3216                              eval "use FS::TicketSystem;";
3217                              die $@ if $@;
3218                              FS::TicketSystem->queue(shift);
3219                            } else {
3220                              '';
3221                            }
3222                          },
3223   },
3224
3225   {
3226     'key'         => 'ticket_system-requestor',
3227     'section'     => 'ticketing',
3228     'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
3229     'type'        => 'text',
3230   },
3231
3232   {
3233     'key'         => 'ticket_system-priority_reverse',
3234     'section'     => 'ticketing',
3235     '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.',
3236     'type'        => 'checkbox',
3237   },
3238
3239   {
3240     'key'         => 'ticket_system-custom_priority_field',
3241     'section'     => 'ticketing',
3242     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
3243     'type'        => 'text',
3244   },
3245
3246   {
3247     'key'         => 'ticket_system-custom_priority_field-values',
3248     'section'     => 'ticketing',
3249     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
3250     'type'        => 'textarea',
3251   },
3252
3253   {
3254     'key'         => 'ticket_system-custom_priority_field_queue',
3255     'section'     => 'ticketing',
3256     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
3257     'type'        => 'text',
3258   },
3259
3260   {
3261     'key'         => 'ticket_system-selfservice_priority_field',
3262     'section'     => 'ticketing',
3263     'description' => 'Custom field from the ticket system to use as a customer-managed priority field.',
3264     'type'        => 'text',
3265   },
3266
3267   {
3268     'key'         => 'ticket_system-selfservice_edit_subject',
3269     'section'     => 'ticketing',
3270     'description' => 'Allow customers to edit ticket subjects through selfservice.',
3271     'type'        => 'checkbox',
3272   },
3273
3274   {
3275     'key'         => 'ticket_system-appointment-queueid',
3276     'section'     => 'appointments',
3277     'description' => 'Ticketing queue to use for appointments.',
3278     #false laziness w/above
3279     'type'        => 'select-sub',
3280     'options_sub' => sub {
3281                            my $conf = new FS::Conf;
3282                            if ( $conf->config('ticket_system') ) {
3283                              eval "use FS::TicketSystem;";
3284                              die $@ if $@;
3285                              FS::TicketSystem->queues();
3286                            } else {
3287                              ();
3288                            }
3289                          },
3290     'option_sub'  => sub { 
3291                            my $conf = new FS::Conf;
3292                            if ( $conf->config('ticket_system') ) {
3293                              eval "use FS::TicketSystem;";
3294                              die $@ if $@;
3295                              FS::TicketSystem->queue(shift);
3296                            } else {
3297                              '';
3298                            }
3299                          },
3300   },
3301
3302   {
3303     'key'         => 'ticket_system-appointment-custom_field',
3304     'section'     => 'appointments',
3305     'description' => 'Ticketing custom field to use as an appointment classification.',
3306     'type'        => 'text',
3307   },
3308
3309   {
3310     'key'         => 'ticket_system-escalation',
3311     'section'     => 'ticketing',
3312     'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
3313     'type'        => 'checkbox',
3314   },
3315
3316   {
3317     'key'         => 'ticket_system-rt_external_datasrc',
3318     'section'     => 'ticketing',
3319     '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>',
3320     'type'        => 'text',
3321
3322   },
3323
3324   {
3325     'key'         => 'ticket_system-rt_external_url',
3326     'section'     => 'ticketing',
3327     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
3328     'type'        => 'text',
3329   },
3330
3331   {
3332     'key'         => 'company_name',
3333     'section'     => 'important',
3334     'description' => 'Your company name',
3335     'type'        => 'text',
3336     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
3337   },
3338
3339   {
3340     'key'         => 'company_url',
3341     'section'     => 'UI',
3342     'description' => 'Your company URL',
3343     'type'        => 'text',
3344     'per_agent'   => 1,
3345   },
3346
3347   {
3348     'key'         => 'company_address',
3349     'section'     => 'important',
3350     'description' => 'Your company address',
3351     'type'        => 'textarea',
3352     'per_agent'   => 1,
3353   },
3354
3355   {
3356     'key'         => 'company_phonenum',
3357     'section'     => 'important',
3358     'description' => 'Your company phone number',
3359     'type'        => 'text',
3360     'per_agent'   => 1,
3361   },
3362
3363   {
3364     'key'         => 'address1-search',
3365     'section'     => 'addresses',
3366     'description' => 'Enable the ability to search the address1 field from the quick customer search.  Not recommended in most cases as it tends to bring up too many search results - use explicit address searching from the advanced customer search instead.',
3367     'type'        => 'checkbox',
3368   },
3369
3370   {
3371     'key'         => 'address2-search',
3372     'section'     => 'addresses',
3373     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
3374     'type'        => 'checkbox',
3375   },
3376
3377   {
3378     'key'         => 'cust_main-require_address2',
3379     'section'     => 'addresses',
3380     'description' => 'Second address field is required.  Also enables "Unit" labeling of address2 on customer view and edit pages.  Useful for multi-tenant applications.  See also: address2-search', # service address only part not working in the modern world, see #41184  (on service address only, if billing and service addresses differ)
3381     'type'        => 'checkbox',
3382   },
3383
3384   {
3385     'key'         => 'agent-ship_address',
3386     'section'     => 'addresses',
3387     '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.",
3388     'type'        => 'checkbox',
3389     'per_agent'   => 1,
3390   },
3391
3392   { 'key'         => 'selfservice_server-cache_module',
3393     'section'     => 'self-service',
3394     '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.',
3395     'type'        => 'select',
3396     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
3397   },
3398
3399   {
3400     'key'         => 'hylafax',
3401     'section'     => 'deprecated',
3402     '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).',
3403     'type'        => [qw( checkbox textarea )],
3404   },
3405
3406   {
3407     'key'         => 'cust_bill-ftpformat',
3408     'section'     => 'print_services',
3409     'description' => 'Enable FTP of raw invoice data - format.',
3410     'type'        => 'select',
3411     'options'     => [ spool_formats() ],
3412   },
3413
3414   {
3415     'key'         => 'cust_bill-ftpserver',
3416     'section'     => 'print_services',
3417     'description' => 'Enable FTP of raw invoice data - server.',
3418     'type'        => 'text',
3419   },
3420
3421   {
3422     'key'         => 'cust_bill-ftpusername',
3423     'section'     => 'print_services',
3424     'description' => 'Enable FTP of raw invoice data - server.',
3425     'type'        => 'text',
3426   },
3427
3428   {
3429     'key'         => 'cust_bill-ftppassword',
3430     'section'     => 'print_services',
3431     'description' => 'Enable FTP of raw invoice data - server.',
3432     'type'        => 'text',
3433   },
3434
3435   {
3436     'key'         => 'cust_bill-ftpdir',
3437     'section'     => 'print_services',
3438     'description' => 'Enable FTP of raw invoice data - server.',
3439     'type'        => 'text',
3440   },
3441
3442   {
3443     'key'         => 'cust_bill-spoolformat',
3444     'section'     => 'print_services',
3445     'description' => 'Enable spooling of raw invoice data - format.',
3446     'type'        => 'select',
3447     'options'     => [ spool_formats() ],
3448   },
3449
3450   {
3451     'key'         => 'cust_bill-spoolagent',
3452     'section'     => 'print_services',
3453     'description' => 'Enable per-agent spooling of raw invoice data.',
3454     'type'        => 'checkbox',
3455   },
3456
3457   {
3458     'key'         => 'bridgestone-batch_counter',
3459     'section'     => 'print_services',
3460     'description' => 'Batch counter for spool files.  Increments every time a spool file is uploaded.',
3461     'type'        => 'text',
3462     'per_agent'   => 1,
3463   },
3464
3465   {
3466     'key'         => 'bridgestone-prefix',
3467     'section'     => 'print_services',
3468     'description' => 'Agent identifier for uploading to BABT printing service.',
3469     'type'        => 'text',
3470     'per_agent'   => 1,
3471   },
3472
3473   {
3474     'key'         => 'bridgestone-confirm_template',
3475     'section'     => 'print_services',
3476     'description' => 'Confirmation email template for uploading to BABT service.  Text::Template format, with variables "$zipfile" (name of the zipped file), "$seq" (sequence number), "$prefix" (user ID string), and "$rows" (number of records in the file).  Should include Subject: and To: headers, separated from the rest of the message by a blank line.',
3477     # this could use a true message template, but it's hard to see how that
3478     # would make the world a better place
3479     'type'        => 'textarea',
3480     'per_agent'   => 1,
3481   },
3482
3483   {
3484     'key'         => 'ics-confirm_template',
3485     'section'     => 'print_services',
3486     'description' => 'Confirmation email template for uploading to ICS invoice printing.  Text::Template format, with variables "%count" and "%sum".',
3487     'type'        => 'textarea',
3488     'per_agent'   => 1,
3489   },
3490
3491   {
3492     'key'         => 'svc_acct-usage_suspend',
3493     'section'     => 'suspension',
3494     '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.',
3495     'type'        => 'checkbox',
3496   },
3497
3498   {
3499     'key'         => 'svc_acct-usage_unsuspend',
3500     'section'     => 'suspension',
3501     '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.',
3502     'type'        => 'checkbox',
3503   },
3504
3505   {
3506     'key'         => 'svc_acct-usage_threshold',
3507     'section'     => 'notification',
3508     '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.',
3509     'type'        => 'text',
3510   },
3511
3512   {
3513     'key'         => 'overlimit_groups',
3514     'section'     => 'suspension',
3515     'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
3516     'type'        => 'select-sub',
3517     'per_agent'   => 1,
3518     'multiple'    => 1,
3519     'options_sub' => sub { require FS::Record;
3520                            require FS::radius_group;
3521                            map { $_->groupnum => $_->long_description }
3522                                FS::Record::qsearch('radius_group', {} );
3523                          },
3524     'option_sub'  => sub { require FS::Record;
3525                            require FS::radius_group;
3526                            my $radius_group = FS::Record::qsearchs(
3527                              'radius_group', { 'groupnum' => shift }
3528                            );
3529                $radius_group ? $radius_group->long_description : '';
3530                          },
3531   },
3532
3533   {
3534     'key'         => 'cust-fields',
3535     'section'     => 'reporting',
3536     'description' => 'Which customer fields to display on reports by default',
3537     'type'        => 'select',
3538     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
3539   },
3540
3541   {
3542     'key'         => 'cust_location-label_prefix',
3543     'section'     => 'addresses',
3544     'description' => 'Optional "site ID" to show in the location label',
3545     'type'        => 'select',
3546     'select_hash' => [ '' => '',
3547                        'CoStAg'    => 'CoStAgXXXXX (country, state, agent name, locationnum)',
3548                        '_location' => 'Manually defined per location',
3549                       ],
3550   },
3551
3552   {
3553     'key'         => 'cust_pkg-display_times',
3554     'section'     => 'packages',
3555     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
3556     'type'        => 'checkbox',
3557   },
3558
3559   {
3560     'key'         => 'cust_pkg-group_by_location',
3561     'section'     => 'packages',
3562     'description' => "Group packages by location.",
3563     'type'        => 'checkbox',
3564   },
3565
3566   {
3567     'key'         => 'cust_pkg-large_pkg_size',
3568     'section'     => 'scalability',
3569     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
3570     'type'        => 'text',
3571   },
3572
3573   {
3574     'key'         => 'cust_pkg-hide_discontinued-part_svc',
3575     'section'     => 'packages',
3576     'description' => "In customer view, hide provisioned services which are no longer available in the package definition.  Not normally used except for very specific situations as it hides still-provisioned services.",
3577     'type'        => 'checkbox',
3578   },
3579
3580   {
3581     'key'         => 'part_pkg-show_fcc_options',
3582     'section'     => 'packages',
3583     'description' => "Show fields on package definitions for FCC Form 477 classification",
3584     'type'        => 'checkbox',
3585   },
3586
3587   {
3588     'key'         => 'svc_acct-edit_uid',
3589     'section'     => 'shell',
3590     'description' => 'Allow UID editing.',
3591     'type'        => 'checkbox',
3592   },
3593
3594   {
3595     'key'         => 'svc_acct-edit_gid',
3596     'section'     => 'shell',
3597     'description' => 'Allow GID editing.',
3598     'type'        => 'checkbox',
3599   },
3600
3601   {
3602     'key'         => 'svc_acct-no_edit_username',
3603     'section'     => 'shell',
3604     'description' => 'Disallow username editing.',
3605     'type'        => 'checkbox',
3606   },
3607
3608   {
3609     'key'         => 'zone-underscore',
3610     'section'     => 'BIND',
3611     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
3612     'type'        => 'checkbox',
3613   },
3614
3615   {
3616     'key'         => 'echeck-country',
3617     'section'     => 'e-checks',
3618     'description' => 'Format electronic check information for the specified country.',
3619     'type'        => 'select',
3620     'select_hash' => [ 'US' => 'United States',
3621                        'CA' => 'Canada (enables branch)',
3622                        'XX' => 'Other',
3623                      ],
3624   },
3625
3626   {
3627     'key'         => 'voip-cust_accountcode_cdr',
3628     'section'     => 'telephony_invoicing',
3629     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
3630     'type'        => 'checkbox',
3631   },
3632
3633   {
3634     'key'         => 'voip-cust_cdr_squelch',
3635     'section'     => 'telephony_invoicing',
3636     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
3637     'type'        => 'checkbox',
3638   },
3639
3640   {
3641     'key'         => 'voip-cdr_email',
3642     'section'     => 'telephony_invoicing',
3643     'description' => 'Include the call details inline on emailed invoices (and HTML invoices viewed in the backend), even if the customer is configured for not printing them on the invoices.  Useful for including these details in electronic delivery but omitting them when printing.',
3644     'type'        => 'checkbox',
3645   },
3646
3647   {
3648     'key'         => 'voip-cdr_email_attach',
3649     'section'     => 'telephony_invoicing',
3650     'description' => 'Enable the per-customer option for including CDR information as an attachment on emailed invoices.',
3651     'type'        => 'select',
3652     'select_hash' => [ ''    => 'Disabled',
3653                        'csv' => 'Text (CSV) attachment',
3654                        'zip' => 'Zip attachment',
3655                      ],
3656   },
3657
3658   {
3659     'key'         => 'cgp_rule-domain_templates',
3660     'section'     => 'services',
3661     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
3662     'type'        => 'textarea',
3663   },
3664
3665   {
3666     'key'         => 'svc_forward-no_srcsvc',
3667     'section'     => 'services',
3668     'description' => "Don't allow forwards from existing accounts, only arbitrary addresses.  Useful when exporting to systems such as Communigate Pro which treat forwards in this fashion.",
3669     'type'        => 'checkbox',
3670   },
3671
3672   {
3673     'key'         => 'svc_forward-arbitrary_dst',
3674     'section'     => 'services',
3675     '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.",
3676     'type'        => 'checkbox',
3677   },
3678
3679   {
3680     'key'         => 'tax-ship_address',
3681     'section'     => 'taxation',
3682     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
3683     'type'        => 'checkbox',
3684   }
3685 ,
3686   {
3687     'key'         => 'tax-pkg_address',
3688     'section'     => 'taxation',
3689     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the package address instead (when present).',
3690     'type'        => 'checkbox',
3691   },
3692
3693   {
3694     'key'         => 'invoice-ship_address',
3695     'section'     => 'invoicing',
3696     'description' => 'Include the shipping address on invoices.',
3697     'type'        => 'checkbox',
3698   },
3699
3700   {
3701     'key'         => 'invoice-all_pkg_addresses',
3702     'section'     => 'invoicing',
3703     'description' => 'Show all package addresses on invoices, even the default.',
3704     'type'        => 'checkbox',
3705   },
3706
3707   {
3708     'key'         => 'invoice-unitprice',
3709     'section'     => 'invoicing',
3710     'description' => 'Enable unit pricing on invoices and quantities on packages.',
3711     'type'        => 'checkbox',
3712   },
3713
3714   {
3715     'key'         => 'invoice-smallernotes',
3716     'section'     => 'invoicing',
3717     'description' => 'Display the notes section in a smaller font on invoices.',
3718     'type'        => 'checkbox',
3719   },
3720
3721   {
3722     'key'         => 'invoice-smallerfooter',
3723     'section'     => 'invoicing',
3724     'description' => 'Display footers in a smaller font on invoices.',
3725     'type'        => 'checkbox',
3726   },
3727
3728   {
3729     'key'         => 'postal_invoice-fee_pkgpart',
3730     'section'     => 'invoicing',
3731     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
3732     'type'        => 'select-part_pkg',
3733     'per_agent'   => 1,
3734   },
3735
3736   {
3737     'key'         => 'postal_invoice-recurring_only',
3738     'section'     => 'invoicing',
3739     'description' => 'The postal invoice fee is omitted on invoices without recurring charges when this is set.',
3740     'type'        => 'checkbox',
3741   },
3742
3743   {
3744     'key'         => 'batch-enable',
3745     'section'     => 'deprecated', #make sure batch-enable_payby is set for
3746                                    #everyone before removing
3747     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
3748     'type'        => 'checkbox',
3749   },
3750
3751   {
3752     'key'         => 'batch-enable_payby',
3753     'section'     => 'payment_batching',
3754     'description' => 'Enable batch processing for the specified payment types.',
3755     'type'        => 'selectmultiple',
3756     'select_enum' => [qw( CARD CHEK )],
3757   },
3758
3759   {
3760     'key'         => 'realtime-disable_payby',
3761     'section'     => 'payments',
3762     'description' => 'Disable realtime processing for the specified payment types.',
3763     'type'        => 'selectmultiple',
3764     'select_enum' => [qw( CARD CHEK )],
3765   },
3766
3767   {
3768     'key'         => 'batch-default_format',
3769     'section'     => 'payment_batching',
3770     'description' => 'Default format for batches.',
3771     'type'        => 'select',
3772     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch',
3773                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
3774                        'paymentech', 'ach-spiritone', 'RBC', 'CIBC',
3775                     ]
3776   },
3777
3778   { 'key'         => 'batch-gateway-CARD',
3779     'section'     => 'payment_batching',
3780     'description' => 'Business::BatchPayment gateway for credit card batches.',
3781     %batch_gateway_options,
3782   },
3783
3784   { 'key'         => 'batch-gateway-CHEK',
3785     'section'     => 'payment_batching', 
3786     'description' => 'Business::BatchPayment gateway for check batches.',
3787     %batch_gateway_options,
3788   },
3789
3790   {
3791     'key'         => 'batch-reconsider',
3792     'section'     => 'payment_batching',
3793     'description' => 'Allow imported batch results to change the status of payments from previous imports.  Enable this only if your gateway is known to send both positive and negative results for the same batch.',
3794     'type'        => 'checkbox',
3795   },
3796
3797   {
3798     'key'         => 'batch-auto_resolve_days',
3799     'section'     => 'payment_batching',
3800     'description' => 'Automatically resolve payment batches this many days after they were first downloaded.',
3801     'type'        => 'text',
3802   },
3803
3804   {
3805     'key'         => 'batch-auto_resolve_status',
3806     'section'     => 'payment_batching',
3807     'description' => 'When automatically resolving payment batches, take this action for payments of unknown status.',
3808     'type'        => 'select',
3809     'select_enum' => [ 'approve', 'decline' ],
3810   },
3811
3812   # replaces batch-errors_to (sent email on error)
3813   {
3814     'key'         => 'batch-errors_not_fatal',
3815     'section'     => 'payment_batching',
3816     'description' => 'If checked, when importing batches from a gateway, item errors will be recorded in the system log without aborting processing.  If unchecked, batch processing will fail on error.',
3817     'type'        => 'checkbox',
3818   },
3819
3820   #lists could be auto-generated from pay_batch info
3821   {
3822     'key'         => 'batch-fixed_format-CARD',
3823     'section'     => 'payment_batching',
3824     'description' => 'Fixed (unchangeable) format for credit card batches.',
3825     'type'        => 'select',
3826     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
3827                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
3828   },
3829
3830   {
3831     'key'         => 'batch-fixed_format-CHEK',
3832     'section'     => 'payment_batching',
3833     'description' => 'Fixed (unchangeable) format for electronic check batches.',
3834     'type'        => 'select',
3835     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM',
3836                        'PAP', 'paymentech', 'ach-spiritone', 'RBC',
3837                        'td_eft1464', 'eft_canada', 'CIBC'
3838                      ]
3839   },
3840
3841   {
3842     'key'         => 'batch-increment_expiration',
3843     'section'     => 'payment_batching',
3844     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
3845     'type'        => 'checkbox'
3846   },
3847
3848   {
3849     'key'         => 'batchconfig-BoM',
3850     'section'     => 'payment_batching',
3851     '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',
3852     'type'        => 'textarea',
3853   },
3854
3855 {
3856     'key'         => 'batchconfig-CIBC',
3857     'section'     => 'payment_batching',
3858     'description' => 'Configuration for Canadian Imperial Bank of Commerce, six lines: 1. Origin ID, 2. Datacenter, 3. Typecode, 4. Short name, 5. Bank, 6. Bank account',
3859     'type'        => 'textarea',
3860   },
3861
3862   {
3863     'key'         => 'batchconfig-PAP',
3864     'section'     => 'payment_batching',
3865     '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',
3866     'type'        => 'textarea',
3867   },
3868
3869   {
3870     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
3871     'section'     => 'payment_batching',
3872     'description' => 'Gateway ID for Chase Canada E-xact batching',
3873     'type'        => 'text',
3874   },
3875
3876   {
3877     'key'         => 'batchconfig-paymentech',
3878     'section'     => 'payment_batching',
3879     'description' => 'Configuration for Chase Paymentech batching, six lines: 1. BIN, 2. Terminal ID, 3. Merchant ID, 4. Username, 5. Password (for batch uploads), 6. Flag to send recurring indicator.',
3880     'type'        => 'textarea',
3881   },
3882
3883   {
3884     'key'         => 'batchconfig-RBC',
3885     'section'     => 'payment_batching',
3886     'description' => 'Configuration for Royal Bank of Canada PDS batching, five lines: 1. Client number, 2. Short name, 3. Long name, 4. Transaction code 5. (optional) set to TEST to turn on test mode.',
3887     'type'        => 'textarea',
3888   },
3889
3890   {
3891     'key'         => 'batchconfig-RBC-login',
3892     'section'     => 'payment_batching',
3893     'description' => 'FTPS login for uploading Royal Bank of Canada batches. Two lines: 1. username, 2. password. If not supplied, batches can still be created but not automatically uploaded.',
3894     'type'        => 'textarea',
3895   },
3896
3897   {
3898     'key'         => 'batchconfig-td_eft1464',
3899     'section'     => 'payment_batching',
3900     'description' => 'Configuration for TD Bank EFT1464 batching, seven lines: 1. Originator ID, 2. Datacenter Code, 3. Short name, 4. Long name, 5. Returned payment branch number, 6. Returned payment account, 7. Transaction code.',
3901     'type'        => 'textarea',
3902   },
3903
3904   {
3905     'key'         => 'batchconfig-eft_canada',
3906     'section'     => 'payment_batching',
3907     'description' => 'Configuration for EFT Canada batching, five lines: 1. SFTP username, 2. SFTP password, 3. Business transaction code, 4. Personal transaction code, 5. Number of days to delay process date.  If you are using separate per-agent batches (batch-spoolagent), you must set this option separately for each agent, as the global setting will be ignored.',
3908     'type'        => 'textarea',
3909     'per_agent'   => 1,
3910   },
3911
3912   {
3913     'key'         => 'batchconfig-nacha-destination',
3914     'section'     => 'payment_batching',
3915     'description' => 'Configuration for NACHA batching, Destination (9 digit transit routing number).',
3916     'type'        => 'text',
3917   },
3918
3919   {
3920     'key'         => 'batchconfig-nacha-destination_name',
3921     'section'     => 'payment_batching',
3922     'description' => 'Configuration for NACHA batching, Destination (Bank Name, up to 23 characters).',
3923     'type'        => 'text',
3924   },
3925
3926   {
3927     'key'         => 'batchconfig-nacha-origin',
3928     'section'     => 'payment_batching',
3929     'description' => 'Configuration for NACHA batching, Origin (your 10-digit company number, IRS tax ID recommended).',
3930     'type'        => 'text',
3931   },
3932
3933   {
3934     'key'         => 'batchconfig-nacha-origin_name',
3935     'section'     => 'payment_batching',
3936     'description' => 'Configuration for NACHA batching, Origin name (defaults to company name, but sometimes bank name is needed instead.)',
3937     'type'        => 'text',
3938   },
3939
3940   {
3941     'key'         => 'batch-manual_approval',
3942     'section'     => 'payment_batching',
3943     'description' => 'Allow manual batch closure, which will approve all payments that do not yet have a status.  This is not advised unless needed for specific payment processors that provide a report of rejected rather than approved payments.',
3944     'type'        => 'checkbox',
3945   },
3946
3947   {
3948     'key'         => 'batch-spoolagent',
3949     'section'     => 'payment_batching',
3950     'description' => 'Store payment batches per-agent.',
3951     'type'        => 'checkbox',
3952   },
3953
3954   {
3955     'key'         => 'payment_history-years',
3956     'section'     => 'UI',
3957     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
3958     'type'        => 'text',
3959   },
3960
3961   {
3962     'key'         => 'change_history-years',
3963     'section'     => 'UI',
3964     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
3965     'type'        => 'text',
3966   },
3967
3968   {
3969     'key'         => 'cust_main-packages-years',
3970     'section'     => 'packages',
3971     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
3972     'type'        => 'text',
3973   },
3974
3975   {
3976     'key'         => 'cust_main-use_comments',
3977     'section'     => 'deprecated',
3978     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
3979     'type'        => 'checkbox',
3980   },
3981
3982   {
3983     'key'         => 'cust_main-disable_notes',
3984     'section'     => 'customer_fields',
3985     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
3986     'type'        => 'checkbox',
3987   },
3988
3989   {
3990     'key'         => 'cust_main_note-display_times',
3991     'section'     => 'customer_fields',
3992     'description' => 'Display full timestamps (not just dates) for customer notes.',
3993     'type'        => 'checkbox',
3994   },
3995
3996   {
3997     'key'         => 'cust_main_note-require_class',
3998     'section'     => 'customer_fields',
3999     'description' => 'Require customer note classes for customer notes',
4000     'type'        => 'checkbox',
4001   },
4002
4003   {
4004     'key'         => 'cust_main-ticket_statuses',
4005     'section'     => 'ticketing',
4006     'description' => 'Show tickets with these statuses on the customer view page.',
4007     'type'        => 'selectmultiple',
4008     'select_enum' => [qw( new open stalled resolved rejected deleted )],
4009   },
4010
4011   {
4012     'key'         => 'cust_main-max_tickets',
4013     'section'     => 'ticketing',
4014     'description' => 'Maximum number of tickets to show on the customer view page.',
4015     'type'        => 'text',
4016   },
4017
4018   {
4019     'key'         => 'cust_main-enable_birthdate',
4020     'section'     => 'customer_fields',
4021     'description' => 'Enable tracking of a birth date with each customer record',
4022     'type'        => 'checkbox',
4023   },
4024
4025   {
4026     'key'         => 'cust_main-enable_spouse',
4027     'section'     => 'customer_fields',
4028     'description' => 'Enable tracking of a spouse\'s name and date of birth with each customer record',
4029     'type'        => 'checkbox',
4030   },
4031
4032   {
4033     'key'         => 'cust_main-enable_anniversary_date',
4034     'section'     => 'customer_fields',
4035     'description' => 'Enable tracking of an anniversary date with each customer record',
4036     'type'        => 'checkbox',
4037   },
4038
4039   {
4040     'key'         => 'cust_main-edit_calling_list_exempt',
4041     'section'     => 'customer_fields',
4042     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
4043     'type'        => 'checkbox',
4044   },
4045
4046   {
4047     'key'         => 'support-key',
4048     'section'     => 'important',
4049     'description' => 'A support key enables access to <A HREF="http://freeside.biz/freeside/services.html#support">commercial services</A> delivered over the network, such as address normalization and invoice printing.',
4050     'type'        => 'text',
4051   },
4052
4053   {
4054     'key'         => 'freesideinc-webservice-svcpart',
4055     'section'     => 'development',
4056     'description' => 'Do not set this.',
4057     'type'        => 'text',
4058   },
4059
4060   {
4061     'key'         => 'card-types',
4062     'section'     => 'credit_cards',
4063     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
4064     'type'        => 'selectmultiple',
4065     'select_enum' => \@card_types,
4066   },
4067
4068   {
4069     'key'         => 'disable-fuzzy',
4070     'section'     => 'scalability',
4071     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
4072     'type'        => 'checkbox',
4073   },
4074
4075   {
4076     'key'         => 'fuzzy-fuzziness',
4077     'section'     => 'scalability',
4078     'description' => 'Set the "fuzziness" of fuzzy searching (see the String::Approx manpage for details).  Defaults to 10%',
4079     'type'        => 'text',
4080   },
4081
4082   { 'key'         => 'pkg_referral',
4083     'section'     => 'packages',
4084     'description' => 'Enable package-specific advertising sources.',
4085     'type'        => 'checkbox',
4086   },
4087
4088   { 'key'         => 'pkg_referral-multiple',
4089     'section'     => 'packages',
4090     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
4091     'type'        => 'checkbox',
4092   },
4093
4094   {
4095     'key'         => 'dashboard-install_welcome',
4096     'section'     => 'UI',
4097     'description' => 'New install welcome screen.',
4098     'type'        => 'select',
4099     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
4100   },
4101
4102   {
4103     'key'         => 'dashboard-toplist',
4104     'section'     => 'UI',
4105     'description' => 'List of items to display on the top of the front page',
4106     'type'        => 'textarea',
4107   },
4108
4109   {
4110     'key'         => 'impending_recur_msgnum',
4111     'section'     => 'notification',
4112     'description' => 'Template to use for alerts about first-time recurring billing.',
4113     %msg_template_options,
4114   },
4115
4116   {
4117     'key'         => 'logo.png',
4118     'section'     => 'important',  #'invoicing' ?
4119     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
4120     'type'        => 'image',
4121     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
4122                         #old-style editor anyway...?
4123     'per_locale'  => 1,
4124   },
4125
4126   {
4127     'key'         => 'logo.eps',
4128     'section'     => 'printing',
4129     'description' => 'Company logo for printed and PDF invoices and quotations, in EPS format.',
4130     'type'        => 'image',
4131     'per_agent'   => 1, #XXX as above, kinda
4132     'per_locale'  => 1,
4133   },
4134
4135   {
4136     'key'         => 'selfservice-ignore_quantity',
4137     'section'     => 'self-service',
4138     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
4139     'type'        => 'checkbox',
4140   },
4141
4142   {
4143     'key'         => 'selfservice-session_timeout',
4144     'section'     => 'self-service',
4145     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
4146     'type'        => 'select',
4147     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
4148   },
4149
4150   # 3.x-only options for a more tolerant password policy
4151
4152 #  {
4153 #    'key'         => 'password-generated-characters',
4154 #    'section'     => 'password',
4155 #    'description' => 'Set of characters to use when generating random passwords. This must contain at least one lowercase letter, uppercase letter, digit, and punctuation mark.',
4156 #    'type'        => 'textarea',
4157 #  },
4158 #
4159 #  {
4160 #    'key'         => 'password-no_reuse',
4161 #    'section'     => 'password',
4162 #    'description' => 'Minimum number of password changes before a password can be reused. By default, passwords can be reused without restriction.',
4163 #    'type'        => 'text',
4164 #  },
4165 #
4166   {
4167     'key'         => 'datavolume-forcemegabytes',
4168     'section'     => 'UI',
4169     'description' => 'All data volumes are expressed in megabytes',
4170     'type'        => 'checkbox',
4171   },
4172
4173   {
4174     'key'         => 'datavolume-significantdigits',
4175     'section'     => 'UI',
4176     'description' => 'number of significant digits to use to represent data volumes',
4177     'type'        => 'text',
4178   },
4179
4180   {
4181     'key'         => 'disable_void_after',
4182     'section'     => 'payments',
4183     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
4184     'type'        => 'text',
4185   },
4186
4187   {
4188     'key'         => 'disable_line_item_date_ranges',
4189     'section'     => 'invoicing',
4190     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
4191     'type'        => 'checkbox',
4192   },
4193
4194   {
4195     'key'         => 'cust_bill-line_item-date_style',
4196     'section'     => 'invoicing',
4197     'description' => 'Display format for line item date ranges on invoice line items.',
4198     'type'        => 'select',
4199     'select_hash' => [ ''           => 'STARTDATE-ENDDATE',
4200                        'month_of'   => 'Month of MONTHNAME',
4201                        'X_month'    => 'DATE_DESC MONTHNAME',
4202                      ],
4203     'per_agent'   => 1,
4204   },
4205
4206   {
4207     'key'         => 'cust_bill-line_item-date_style-non_monthly',
4208     'section'     => 'invoicing',
4209     'description' => 'If set, override cust_bill-line_item-date_style for non-monthly charges.',
4210     'type'        => 'select',
4211     'select_hash' => [ ''           => 'Default',
4212                        'start_end'  => 'STARTDATE-ENDDATE',
4213                        'month_of'   => 'Month of MONTHNAME',
4214                        'X_month'    => 'DATE_DESC MONTHNAME',
4215                      ],
4216     'per_agent'   => 1,
4217   },
4218
4219   {
4220     'key'         => 'cust_bill-line_item-date_description',
4221     'section'     => 'invoicing',
4222     'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.',
4223     'type'        => 'text',
4224     'per_agent'   => 1,
4225   },
4226
4227   {
4228     'key'         => 'support_packages',
4229     'section'     => 'development',
4230     '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...
4231     'type'        => 'select-part_pkg',
4232     'multiple'    => 1,
4233   },
4234
4235   {
4236     'key'         => 'cust_main-require_phone',
4237     'section'     => 'customer_fields',
4238     'description' => 'Require daytime or night phone for all customer records.',
4239     'type'        => 'checkbox',
4240     'per_agent'   => 1,
4241   },
4242
4243   {
4244     'key'         => 'cust_main-require_invoicing_list_email',
4245     'section'     => 'customer_fields',
4246     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
4247     'type'        => 'checkbox',
4248     'per_agent'   => 1,
4249   },
4250
4251   {
4252     'key'         => 'cust_main-require_classnum',
4253     'section'     => 'customer_fields',
4254     'description' => 'Customer class is required: require customer class for all customer records.',
4255     'type'        => 'checkbox',
4256   },
4257
4258   {
4259     'key'         => 'cust_main-check_unique',
4260     'section'     => 'customer_fields',
4261     'description' => 'Warn before creating a customer record where these fields duplicate another customer.',
4262     'type'        => 'select',
4263     'multiple'    => 1,
4264     'select_hash' => [ 
4265       'address' => 'Billing or service address',
4266     ],
4267   },
4268
4269   {
4270     'key'         => 'svc_acct-display_paid_time_remaining',
4271     'section'     => 'services',
4272     'description' => 'Show paid time remaining in addition to time remaining.',
4273     'type'        => 'checkbox',
4274   },
4275
4276   {
4277     'key'         => 'cancel_credit_type',
4278     'section'     => 'cancellation',
4279     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
4280     reason_type_options('R'),
4281   },
4282
4283   {
4284     'key'         => 'suspend_credit_type',
4285     'section'     => 'suspension',
4286     'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.',
4287     reason_type_options('R'),
4288   },
4289
4290   {
4291     'key'         => 'prepayment_discounts-credit_type',
4292     'section'     => 'billing',
4293     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
4294     reason_type_options('R'),
4295   },
4296
4297   {
4298     'key'         => 'cust_main-agent_custid-format',
4299     'section'     => 'customer_number',
4300     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
4301     'type'        => 'select',
4302     'select_hash' => [
4303                        ''       => 'Numeric only',
4304                        '\d{7}'  => 'Numeric only, exactly 7 digits',
4305                        'ww?d+'  => 'Numeric with one or two letter prefix',
4306                        'd+-w'   => 'Numeric with a dash and one letter suffix',
4307                      ],
4308   },
4309
4310   {
4311     'key'         => 'card_masking_method',
4312     'section'     => 'credit_cards',
4313     '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.',
4314     'type'        => 'select',
4315     'select_hash' => [
4316                        ''            => '123456xxxxxx1234',
4317                        'first6last2' => '123456xxxxxxxx12',
4318                        'first4last4' => '1234xxxxxxxx1234',
4319                        'first4last2' => '1234xxxxxxxxxx12',
4320                        'first2last4' => '12xxxxxxxxxx1234',
4321                        'first2last2' => '12xxxxxxxxxxxx12',
4322                        'first0last4' => 'xxxxxxxxxxxx1234',
4323                        'first0last2' => 'xxxxxxxxxxxxxx12',
4324                      ],
4325   },
4326
4327   {
4328     'key'         => 'disable_previous_balance',
4329     'section'     => 'invoice_balances',
4330     'description' => 'Show new charges only; do not list previous invoices, payments, or credits on the invoice.',
4331     'type'        => 'checkbox',
4332     'per_agent'   => 1,
4333   },
4334
4335   {
4336     'key'         => 'previous_balance-exclude_from_total',
4337     'section'     => 'invoice_balances',
4338     'description' => 'Show separate totals for previous invoice balance and new charges. Only meaningful when invoice_sections is false.',
4339     'type'        => 'checkbox',
4340   },
4341
4342   {
4343     'key'         => 'previous_balance-text',
4344     'section'     => 'invoice_balances',
4345     'description' => 'Text for the label of the total previous balance, when it is shown separately. Defaults to "Previous Balance".',
4346     'type'        => 'text',
4347     'per_locale'  => 1,
4348   },
4349
4350   {
4351     'key'         => 'previous_balance-text-total_new_charges',
4352     'section'     => 'invoice_balances',
4353     'description' => 'Text for the label of the total of new charges, when it is shown separately. If invoice_show_prior_due_date is enabled, the due date of current charges will be appended. Defaults to "Total New Charges".',
4354     'type'        => 'text',
4355     'per_locale'  => 1,
4356   },
4357
4358   {
4359     'key'         => 'previous_balance-section',
4360     'section'     => 'invoice_balances',
4361     'description' => 'Show previous invoice balances in a separate invoice section.  Does not require invoice_sections to be enabled.',
4362     'type'        => 'checkbox',
4363   },
4364
4365   {
4366     'key'         => 'previous_balance-summary_only',
4367     'section'     => 'invoice_balances',
4368     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
4369     'type'        => 'checkbox',
4370   },
4371
4372   {
4373     'key'         => 'previous_balance-show_credit',
4374     'section'     => 'invoice_balances',
4375     'description' => 'Show the customer\'s credit balance on invoices when applicable.',
4376     'type'        => 'checkbox',
4377   },
4378
4379   {
4380     'key'         => 'previous_balance-show_on_statements',
4381     'section'     => 'invoice_balances',
4382     'description' => 'Show previous invoices on statements, without itemized charges.',
4383     'type'        => 'checkbox',
4384   },
4385
4386   {
4387     'key'         => 'previous_balance-payments_since',
4388     'section'     => 'invoice_balances',
4389     'description' => 'Instead of showing payments (and credits) applied to the invoice, show those received since the previous invoice date.',
4390     'type'        => 'checkbox',
4391   },
4392
4393   {
4394     'key'         => 'previous_invoice_history',
4395     'section'     => 'invoice_balances',
4396     'description' => 'Show a month-by-month history of the customer\'s '.
4397                      'billing amounts.  This requires template '.
4398                      'modification and is currently not supported on the '.
4399                      'stock template.',
4400     'type'        => 'checkbox',
4401   },
4402
4403   {
4404     'key'         => 'balance_due_below_line',
4405     'section'     => 'invoice_balances',
4406     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
4407     'type'        => 'checkbox',
4408   },
4409
4410   {
4411     'key'         => 'always_show_tax',
4412     'section'     => 'taxation',
4413     'description' => 'Show a line for tax on the invoice even when the tax is zero.  Optionally provide text for the tax name to show.',
4414     'type'        => [ qw(checkbox text) ],
4415   },
4416
4417   {
4418     'key'         => 'address_standardize_method',
4419     'section'     => 'addresses', #???
4420     'description' => 'Method for standardizing customer addresses.',
4421     'type'        => 'select',
4422     'select_hash' => [ '' => '', 
4423                        'uscensus' => 'U.S. Census Bureau',
4424                        'usps'     => 'U.S. Postal Service',
4425                        'melissa'  => 'Melissa WebSmart',
4426                        'freeside' => 'Freeside web service (support contract required)',
4427                      ],
4428   },
4429
4430   {
4431     'key'         => 'usps_webtools-userid',
4432     'section'     => 'addresses',
4433     '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.',
4434     'type'        => 'text',
4435   },
4436
4437   {
4438     'key'         => 'usps_webtools-password',
4439     'section'     => 'addresses',
4440     '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.',
4441     'type'        => 'text',
4442   },
4443
4444   {
4445     'key'         => 'melissa-userid',
4446     'section'     => 'addresses', # it's really not...
4447     'description' => 'User ID for Melissa WebSmart service.  See <a href="http://www.melissadata.com/">the Melissa website</a> for access and pricing.',
4448     'type'        => 'text',
4449   },
4450
4451   {
4452     'key'         => 'melissa-enable_geocoding',
4453     'section'     => 'addresses',
4454     'description' => 'Use the Melissa service for census tract and coordinate lookups.  Enable this only if your subscription includes geocoding access.',
4455     'type'        => 'checkbox',
4456   },
4457
4458   {
4459     'key'         => 'cust_main-auto_standardize_address',
4460     'section'     => 'addresses',
4461     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
4462     'type'        => 'checkbox',
4463   },
4464
4465   {
4466     'key'         => 'cust_main-require_censustract',
4467     'section'     => 'addresses',
4468     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
4469     'type'        => 'checkbox',
4470   },
4471
4472   {
4473     'key'         => 'cust_main-no_city_in_address',
4474     'section'     => 'localization',
4475     'description' => 'Turn off City for billing & shipping addresses',
4476     'type'        => 'checkbox',
4477   },
4478
4479   {
4480     'key'         => 'census_year',
4481     'section'     => 'addresses',
4482     'description' => 'The year to use in census tract lookups.  NOTE: you need to select 2012 or 2013 for Year 2010 Census tract codes.  A selection of 2011 provides Year 2000 Census tract codes.  Use the freeside-censustract-update tool if exisitng customers need to be changed.',
4483     'type'        => 'select',
4484     'select_enum' => [ qw( 2017 2016 2015 ) ],
4485   },
4486
4487   {
4488     'key'         => 'tax_district_method',
4489     'section'     => 'taxation',
4490     'description' => 'The method to use to look up tax district codes.',
4491     'type'        => 'select',
4492     #'select_hash' => [ FS::Misc::Geo::get_district_methods() ],
4493     #after RT#13763, using FS::Misc::Geo here now causes a dependancy loop :/
4494     'select_hash' => [
4495                        ''         => '',
4496                        'wa_sales' => 'Washington sales tax',
4497                      ],
4498   },
4499
4500   {
4501     'key'         => 'tax_district_taxname',
4502     'section'     => 'taxation',
4503     'description' => 'The tax name to display on the invoice for district sales taxes. Defaults to "Tax".',
4504     'type'        => 'text',
4505   },
4506
4507   {
4508     'key'         => 'company_latitude',
4509     'section'     => 'taxation',
4510     'description' => 'For Avalara taxation, your company latitude (-90 through 90)',
4511     'type'        => 'text',
4512   },
4513
4514   {
4515     'key'         => 'company_longitude',
4516     'section'     => 'taxation',
4517     'description' => 'For Avalara taxation, your company longitude (-180 thru 180)',
4518     'type'        => 'text',
4519   },
4520
4521   #if we can't change it from the default yet, what good is it to the end-user? 
4522   #{
4523   #  'key'         => 'geocode_module',
4524   #  'section'     => 'addresses',
4525   #  'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
4526   #  'type'        => 'select',
4527   #  'select_enum' => [ 'Geo::Coder::Googlev3' ],
4528   #},
4529
4530   {
4531     'key'         => 'geocode-require_nw_coordinates',
4532     'section'     => 'addresses',
4533     'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
4534     'type'        => 'checkbox',
4535   },
4536
4537   {
4538     'key'         => 'disable_acl_changes',
4539     'section'     => 'development',
4540     'description' => 'Disable all ACL changes, for demos.',
4541     'type'        => 'checkbox',
4542   },
4543
4544   {
4545     'key'         => 'disable_settings_changes',
4546     'section'     => 'development',
4547     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
4548     'type'        => [qw( checkbox text )],
4549   },
4550
4551   {
4552     'key'         => 'cust_main-edit_agent_custid',
4553     'section'     => 'customer_number',
4554     'description' => 'Enable editing of the agent_custid field.',
4555     'type'        => 'checkbox',
4556   },
4557
4558   {
4559     'key'         => 'cust_main-default_agent_custid',
4560     'section'     => 'customer_number',
4561     'description' => 'Display the agent_custid field when available instead of the custnum field.  Restart Apache after changing.',
4562     'type'        => 'checkbox',
4563   },
4564
4565   {
4566     'key'         => 'cust_main-title-display_custnum',
4567     'section'     => 'customer_number',
4568     'description' => 'Add the display_custnum (agent_custid or custnum) to the title on customer view pages.',
4569     'type'        => 'checkbox',
4570   },
4571
4572   {
4573     'key'         => 'cust_bill-default_agent_invid',
4574     'section'     => 'invoicing',
4575     'description' => 'Display the agent_invid field when available instead of the invnum field.',
4576     'type'        => 'checkbox',
4577   },
4578
4579   {
4580     'key'         => 'cust_main-auto_agent_custid',
4581     'section'     => 'customer_number',
4582     'description' => 'Automatically assign an agent_custid - select format',
4583     'type'        => 'select',
4584     'select_hash' => [ '' => 'No',
4585                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
4586                      ],
4587   },
4588
4589   {
4590     'key'         => 'cust_main-custnum-display_prefix',
4591     'section'     => 'customer_number',
4592     'description' => 'Prefix the customer number with this string for display purposes.',
4593     'type'        => 'text',
4594     'per_agent'   => 1,
4595   },
4596
4597   {
4598     'key'         => 'cust_main-custnum-display_length',
4599     'section'     => 'customer_number',
4600     'description' => 'Zero fill the customer number to this many digits for display purposes.  Restart Apache after changing.',
4601     'type'        => 'text',
4602   },
4603
4604   {
4605     'key'         => 'cust_main-default_areacode',
4606     'section'     => 'localization',
4607     'description' => 'Default area code for customers.',
4608     'type'        => 'text',
4609   },
4610
4611   {
4612     'key'         => 'order_pkg-no_start_date',
4613     'section'     => 'packages',
4614     'description' => 'Don\'t set a default start date for new packages.',
4615     'type'        => 'checkbox',
4616   },
4617
4618   {
4619     'key'         => 'part_pkg-delay_start',
4620     'section'     => 'packages',
4621     'description' => 'Enabled "delayed start" option for packages.',
4622     'type'        => 'checkbox',
4623   },
4624
4625   {
4626     'key'         => 'part_pkg-delay_cancel-days',
4627     'section'     => 'cancellation',
4628     'description' => 'Number of days to suspend when using automatic suspension period before cancel (default is 1)',
4629     'type'        => 'text',
4630     'validate'    => sub { (($_[0] =~ /^\d*$/) && (($_[0] eq '') || $_[0]))
4631                            ? ''
4632                            : 'Must specify an integer number of days' }
4633   },
4634
4635   {
4636     'key'         => 'mcp_svcpart',
4637     'section'     => 'development',
4638     'description' => 'Master Control Program svcpart.  Leave this blank.',
4639     'type'        => 'text', #select-part_svc
4640   },
4641
4642   {
4643     'key'         => 'cust_bill-max_same_services',
4644     'section'     => 'invoicing',
4645     '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.',
4646     'type'        => 'text',
4647   },
4648
4649   {
4650     'key'         => 'cust_bill-consolidate_services',
4651     'section'     => 'invoicing',
4652     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
4653     'type'        => 'checkbox',
4654   },
4655
4656   {
4657     'key'         => 'suspend_email_admin',
4658     'section'     => 'suspension',
4659     'description' => 'Destination admin email address to enable suspension notices',
4660     'type'        => 'text',
4661   },
4662
4663   {
4664     'key'         => 'unsuspend_email_admin',
4665     'section'     => 'suspension',
4666     'description' => 'Destination admin email address to enable unsuspension notices',
4667     'type'        => 'text',
4668   },
4669   
4670   {
4671     'key'         => 'selfservice-head',
4672     'section'     => 'self-service_skinning',
4673     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
4674     'type'        => 'textarea', #htmlarea?
4675     'per_agent'   => 1,
4676   },
4677
4678
4679   {
4680     'key'         => 'selfservice-body_header',
4681     'section'     => 'self-service_skinning',
4682     'description' => 'HTML header for the self-service interface',
4683     'type'        => 'textarea', #htmlarea?
4684     'per_agent'   => 1,
4685   },
4686
4687   {
4688     'key'         => 'selfservice-body_footer',
4689     'section'     => 'self-service_skinning',
4690     'description' => 'HTML footer for the self-service interface',
4691     'type'        => 'textarea', #htmlarea?
4692     'per_agent'   => 1,
4693   },
4694
4695
4696   {
4697     'key'         => 'selfservice-body_bgcolor',
4698     'section'     => 'self-service_skinning',
4699     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
4700     'type'        => 'text',
4701     'per_agent'   => 1,
4702   },
4703
4704   {
4705     'key'         => 'selfservice-box_bgcolor',
4706     'section'     => 'self-service_skinning',
4707     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
4708     'type'        => 'text',
4709     'per_agent'   => 1,
4710   },
4711
4712   {
4713     'key'         => 'selfservice-stripe1_bgcolor',
4714     'section'     => 'self-service_skinning',
4715     'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
4716     'type'        => 'text',
4717     'per_agent'   => 1,
4718   },
4719
4720   {
4721     'key'         => 'selfservice-stripe2_bgcolor',
4722     'section'     => 'self-service_skinning',
4723     'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
4724     'type'        => 'text',
4725     'per_agent'   => 1,
4726   },
4727
4728   {
4729     'key'         => 'selfservice-text_color',
4730     'section'     => 'self-service_skinning',
4731     'description' => 'HTML text color for the self-service interface, for example, #000000',
4732     'type'        => 'text',
4733     'per_agent'   => 1,
4734   },
4735
4736   {
4737     'key'         => 'selfservice-link_color',
4738     'section'     => 'self-service_skinning',
4739     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
4740     'type'        => 'text',
4741     'per_agent'   => 1,
4742   },
4743
4744   {
4745     'key'         => 'selfservice-vlink_color',
4746     'section'     => 'self-service_skinning',
4747     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
4748     'type'        => 'text',
4749     'per_agent'   => 1,
4750   },
4751
4752   {
4753     'key'         => 'selfservice-hlink_color',
4754     'section'     => 'self-service_skinning',
4755     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
4756     'type'        => 'text',
4757     'per_agent'   => 1,
4758   },
4759
4760   {
4761     'key'         => 'selfservice-alink_color',
4762     'section'     => 'self-service_skinning',
4763     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
4764     'type'        => 'text',
4765     'per_agent'   => 1,
4766   },
4767
4768   {
4769     'key'         => 'selfservice-font',
4770     'section'     => 'self-service_skinning',
4771     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
4772     'type'        => 'text',
4773     'per_agent'   => 1,
4774   },
4775
4776   {
4777     'key'         => 'selfservice-no_logo',
4778     'section'     => 'self-service_skinning',
4779     'description' => 'Disable the logo in self-service',
4780     'type'        => 'checkbox',
4781     'per_agent'   => 1,
4782   },
4783
4784   {
4785     'key'         => 'selfservice-title_color',
4786     'section'     => 'self-service_skinning',
4787     'description' => 'HTML color for the self-service title, for example, #000000',
4788     'type'        => 'text',
4789     'per_agent'   => 1,
4790   },
4791
4792   {
4793     'key'         => 'selfservice-title_align',
4794     'section'     => 'self-service_skinning',
4795     'description' => 'HTML alignment for the self-service title, for example, center',
4796     'type'        => 'text',
4797     'per_agent'   => 1,
4798   },
4799   {
4800     'key'         => 'selfservice-title_size',
4801     'section'     => 'self-service_skinning',
4802     'description' => 'HTML font size for the self-service title, for example, 3',
4803     'type'        => 'text',
4804     'per_agent'   => 1,
4805   },
4806
4807   {
4808     'key'         => 'selfservice-title_left_image',
4809     'section'     => 'self-service_skinning',
4810     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4811     'type'        => 'image',
4812     'per_agent'   => 1,
4813   },
4814
4815   {
4816     'key'         => 'selfservice-title_right_image',
4817     'section'     => 'self-service_skinning',
4818     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4819     'type'        => 'image',
4820     'per_agent'   => 1,
4821   },
4822
4823   {
4824     'key'         => 'selfservice-menu_disable',
4825     'section'     => 'self-service',
4826     'description' => 'Disable the selected menu entries in the self-service menu',
4827     'type'        => 'selectmultiple',
4828     'select_enum' => [ #false laziness w/myaccount_menu.html
4829                        'Overview',
4830                        'Purchase',
4831                        'Purchase additional package',
4832                        'Recharge my account with a credit card',
4833                        'Recharge my account with a check',
4834                        'Recharge my account with a prepaid card',
4835                        'View my usage',
4836                        'Create a ticket',
4837                        'Setup my services',
4838                        'Change my information',
4839                        'Change billing address',
4840                        'Change service address',
4841                        'Change payment information',
4842                        'Change packages',
4843                        'Change password(s)',
4844                        'Logout',
4845                      ],
4846     'per_agent'   => 1,
4847   },
4848
4849   {
4850     'key'         => 'selfservice-menu_skipblanks',
4851     'section'     => 'self-service',
4852     'description' => 'Skip blank (spacer) entries in the self-service menu',
4853     'type'        => 'checkbox',
4854     'per_agent'   => 1,
4855   },
4856
4857   {
4858     'key'         => 'selfservice-menu_skipheadings',
4859     'section'     => 'self-service',
4860     'description' => 'Skip the unclickable heading entries in the self-service menu',
4861     'type'        => 'checkbox',
4862     'per_agent'   => 1,
4863   },
4864
4865   {
4866     'key'         => 'selfservice-menu_bgcolor',
4867     'section'     => 'self-service_skinning',
4868     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
4869     'type'        => 'text',
4870     'per_agent'   => 1,
4871   },
4872
4873   {
4874     'key'         => 'selfservice-menu_fontsize',
4875     'section'     => 'self-service_skinning',
4876     'description' => 'HTML font size for the self-service menu, for example, -1',
4877     'type'        => 'text',
4878     'per_agent'   => 1,
4879   },
4880   {
4881     'key'         => 'selfservice-menu_nounderline',
4882     'section'     => 'self-service_skinning',
4883     'description' => 'Styles menu links in the self-service without underlining.',
4884     'type'        => 'checkbox',
4885     'per_agent'   => 1,
4886   },
4887
4888
4889   {
4890     'key'         => 'selfservice-menu_top_image',
4891     'section'     => 'self-service_skinning',
4892     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
4893     'type'        => 'image',
4894     'per_agent'   => 1,
4895   },
4896
4897   {
4898     'key'         => 'selfservice-menu_body_image',
4899     'section'     => 'self-service_skinning',
4900     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
4901     'type'        => 'image',
4902     'per_agent'   => 1,
4903   },
4904
4905   {
4906     'key'         => 'selfservice-menu_bottom_image',
4907     'section'     => 'self-service_skinning',
4908     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
4909     'type'        => 'image',
4910     'per_agent'   => 1,
4911   },
4912   
4913   {
4914     'key'         => 'selfservice-view_usage_nodomain',
4915     'section'     => 'self-service',
4916     'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
4917     'type'        => 'checkbox',
4918   },
4919
4920   {
4921     'key'         => 'selfservice-login_banner_image',
4922     'section'     => 'self-service_skinning',
4923     'description' => 'Banner image shown on the login page, in PNG format.',
4924     'type'        => 'image',
4925   },
4926
4927   {
4928     'key'         => 'selfservice-login_banner_url',
4929     'section'     => 'self-service_skinning',
4930     'description' => 'Link for the login banner.',
4931     'type'        => 'text',
4932   },
4933
4934   {
4935     'key'         => 'ng_selfservice-menu',
4936     'section'     => 'self-service',
4937     'description' => 'Custom menu for the next-generation self-service interface.  Each line is in the format "link Label", for example "main.php Home".  Sub-menu items are listed on subsequent lines.  Blank lines terminate the submenu.', #more docs/examples would be helpful
4938     'type'        => 'textarea',
4939   },
4940
4941   {
4942     'key'         => 'signup-no_company',
4943     'section'     => 'signup',
4944     'description' => "Don't display a field for company name on signup.",
4945     'type'        => 'checkbox',
4946   },
4947
4948   {
4949     'key'         => 'signup-recommend_email',
4950     'section'     => 'signup',
4951     'description' => 'Encourage the entry of an invoicing email address on signup.',
4952     'type'        => 'checkbox',
4953   },
4954
4955   {
4956     'key'         => 'signup-recommend_daytime',
4957     'section'     => 'signup',
4958     'description' => 'Encourage the entry of a daytime phone number on signup.',
4959     'type'        => 'checkbox',
4960   },
4961
4962   {
4963     'key'         => 'signup-duplicate_cc-warn_hours',
4964     'section'     => 'signup',
4965     'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
4966     'type'        => 'text',
4967   },
4968
4969   {
4970     'key'         => 'svc_phone-radius-password',
4971     'section'     => 'telephony',
4972     'description' => 'Password when exporting svc_phone records to RADIUS',
4973     'type'        => 'select',
4974     'select_hash' => [
4975       '' => 'Use default from svc_phone-radius-default_password config',
4976       'countrycode_phonenum' => 'Phone number (with country code)',
4977     ],
4978   },
4979
4980   {
4981     'key'         => 'svc_phone-radius-default_password',
4982     'section'     => 'telephony',
4983     'description' => 'Default password when exporting svc_phone records to RADIUS',
4984     'type'        => 'text',
4985   },
4986
4987   {
4988     'key'         => 'svc_phone-allow_alpha_phonenum',
4989     'section'     => 'telephony',
4990     'description' => 'Allow letters in phone numbers.',
4991     'type'        => 'checkbox',
4992   },
4993
4994   {
4995     'key'         => 'svc_phone-domain',
4996     'section'     => 'telephony',
4997     'description' => 'Track an optional domain association with each phone service.',
4998     'type'        => 'checkbox',
4999   },
5000
5001   {
5002     'key'         => 'svc_phone-phone_name-max_length',
5003     'section'     => 'telephony',
5004     'description' => 'Maximum length of the phone service "Name" field (svc_phone.phone_name).  Sometimes useful to limit this (to 15?) when exporting as Caller ID data.',
5005     'type'        => 'text',
5006   },
5007
5008   {
5009     'key'         => 'svc_phone-random_pin',
5010     'section'     => 'telephony',
5011     'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
5012     'type'        => 'text',
5013   },
5014
5015   {
5016     'key'         => 'svc_phone-lnp',
5017     'section'     => 'telephony',
5018     'description' => 'Enables Number Portability features for svc_phone',
5019     'type'        => 'checkbox',
5020   },
5021
5022   {
5023     'key'         => 'svc_phone-bulk_provision_simple',
5024     'section'     => 'telephony',
5025     'description' => 'Bulk provision phone numbers with a simple number range instead of from DID vendor orders',
5026     'type'        => 'checkbox',
5027   },
5028
5029   {
5030     'key'         => 'default_phone_countrycode',
5031     'section'     => 'telephony',
5032     'description' => 'Default countrycode',
5033     'type'        => 'text',
5034   },
5035
5036   {
5037     'key'         => 'cdr-charged_party-field',
5038     'section'     => 'telephony',
5039     'description' => 'Set the charged_party field of CDRs to this field.',
5040     'type'        => 'select-sub',
5041     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
5042                            map { $_ => $fields->{$_}||$_ }
5043                            grep { $_ !~ /^(acctid|charged_party)$/ }
5044                            FS::Schema::dbdef->table('cdr')->columns;
5045                          },
5046     'option_sub'  => sub { my $f = shift;
5047                            FS::cdr->table_info->{'fields'}{$f} || $f;
5048                          },
5049   },
5050
5051   #probably deprecate in favor of cdr-charged_party-field above
5052   {
5053     'key'         => 'cdr-charged_party-accountcode',
5054     'section'     => 'telephony',
5055     'description' => 'Set the charged_party field of CDRs to the accountcode.',
5056     'type'        => 'checkbox',
5057   },
5058
5059   {
5060     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
5061     'section'     => 'telephony',
5062     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
5063     'type'        => 'checkbox',
5064   },
5065
5066 #  {
5067 #    'key'         => 'cdr-charged_party-truncate_prefix',
5068 #    'section'     => '',
5069 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
5070 #    'type'        => 'text',
5071 #  },
5072 #
5073 #  {
5074 #    'key'         => 'cdr-charged_party-truncate_length',
5075 #    'section'     => '',
5076 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
5077 #    'type'        => 'text',
5078 #  },
5079
5080   {
5081     'key'         => 'cdr-skip_duplicate_rewrite',
5082     'section'     => 'telephony',
5083     'description' => 'Use the freeside-cdrrewrited daemon to prevent billing CDRs with a src, dst and calldate identical to an existing CDR',
5084     'type'        => 'checkbox',
5085   },
5086
5087   {
5088     'key'         => 'cdr-charged_party_rewrite',
5089     'section'     => 'telephony',
5090     'description' => 'Do charged party rewriting in the freeside-cdrrewrited daemon; useful if CDRs are being dropped off directly in the database and require special charged_party processing such as cdr-charged_party-accountcode or cdr-charged_party-truncate*.',
5091     'type'        => 'checkbox',
5092   },
5093
5094   {
5095     'key'         => 'cdr-taqua-da_rewrite',
5096     'section'     => 'telephony',
5097     'description' => 'For the Taqua CDR format, a comma-separated list of directory assistance 800 numbers.  Any CDRs with these numbers as "BilledNumber" will be rewritten to the "CallingPartyNumber" (and CallType "12") on import.',
5098     'type'        => 'text',
5099   },
5100
5101   {
5102     'key'         => 'cdr-taqua-accountcode_rewrite',
5103     'section'     => 'telephony',
5104     'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
5105     'type'        => 'checkbox',
5106   },
5107
5108   {
5109     'key'         => 'cdr-taqua-callerid_rewrite',
5110     'section'     => 'telephony',
5111     'description' => 'For the Taqua CDR format, pull Caller ID blocking information from secondary CDRs.',
5112     'type'        => 'checkbox',
5113   },
5114
5115   {
5116     'key'         => 'cdr-asterisk_australia_rewrite',
5117     'section'     => 'telephony',
5118     'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.',
5119     'type'        => 'checkbox',
5120   },
5121
5122   {
5123     'key'         => 'cdr-userfield_dnis_rewrite',
5124     'section'     => 'telephony',
5125     'description' => 'If the CDR userfield contains "DNIS=" followed by a sequence of digits, use that as the destination number for the call.',
5126     'type'        => 'checkbox',
5127   },
5128
5129   {
5130     'key'         => 'cdr-intl_to_domestic_rewrite',
5131     'section'     => 'telephony',
5132     'description' => 'Strip the "011" international prefix from CDR destination numbers if the rest of the number is 7 digits or shorter, and so probably does not contain a country code.',
5133     'type'        => 'checkbox',
5134   },
5135
5136   {
5137     'key'         => 'cdr-gsm_tap3-sender',
5138     'section'     => 'telephony',
5139     'description' => 'GSM TAP3 Sender network (5 letter code)',
5140     'type'        => 'text',
5141   },
5142
5143   {
5144     'key'         => 'cust_pkg-show_autosuspend',
5145     'section'     => 'suspension',
5146     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
5147     'type'        => 'checkbox',
5148   },
5149
5150   {
5151     'key'         => 'cdr-asterisk_forward_rewrite',
5152     'section'     => 'telephony',
5153     'description' => 'Enable special processing for CDRs representing forwarded calls: For CDRs that have a dcontext that starts with "Local/" but does not match dst, set charged_party to dst, parse a new dst from dstchannel, and set amaflags to "2" ("BILL"/"BILLING").',
5154     'type'        => 'checkbox',
5155   },
5156
5157   {
5158     'key'         => 'disable-cust-pkg_class',
5159     'section'     => 'packages',
5160     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
5161     'type'        => 'checkbox',
5162   },
5163
5164   {
5165     'key'         => 'queued-max_kids',
5166     'section'     => 'scalability',
5167     'description' => 'Maximum number of queued processes.  Defaults to 10.',
5168     'type'        => 'text',
5169   },
5170
5171   {
5172     'key'         => 'queued-sleep_time',
5173     'section'     => 'telephony',
5174     'description' => 'Time to sleep between attempts to find new jobs to process in the queue.  Defaults to 10.  Installations doing real-time CDR processing for prepaid may want to set it lower.',
5175     'type'        => 'text',
5176   },
5177
5178   {
5179     'key'         => 'queue-no_history',
5180     'section'     => 'scalability',
5181     'description' => "Don't recreate the h_queue and h_queue_arg tables on upgrades.  This can save disk space for large installs, especially when using prepaid or multi-process billing.  After turning this option on, drop the h_queue and h_queue_arg tables, run freeside-dbdef-create and restart Apache and Freeside.",
5182     'type'        => 'checkbox',
5183   },
5184
5185   {
5186     'key'         => 'cancelled_cust-noevents',
5187     'section'     => 'cancellation',
5188     'description' => "Don't run events for cancelled customers",
5189     'type'        => 'checkbox',
5190   },
5191
5192   {
5193     'key'         => 'agent-invoice_template',
5194     'section'     => 'deprecated',
5195     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
5196     'type'        => 'checkbox',
5197   },
5198
5199   {
5200     'key'         => 'svc_broadband-manage_link',
5201     'section'     => 'wireless_broadband',
5202     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr and $mac_addr.',
5203     'type'        => 'text',
5204   },
5205
5206   {
5207     'key'         => 'svc_broadband-manage_link_text',
5208     'section'     => 'wireless_broadband',
5209     'description' => 'Label for "Manage Device" link',
5210     'type'        => 'text',
5211   },
5212
5213   {
5214     'key'         => 'svc_broadband-manage_link_loc',
5215     'section'     => 'wireless_broadband',
5216     'description' => 'Location for "Manage Device" link',
5217     'type'        => 'select',
5218     'select_hash' => [
5219       'bottom' => 'Near Unprovision link',
5220       'right'  => 'With export-related links',
5221     ],
5222   },
5223
5224   {
5225     'key'         => 'svc_broadband-manage_link-new_window',
5226     'section'     => 'wireless_broadband',
5227     'description' => 'Open the "Manage Device" link in a new window',
5228     'type'        => 'checkbox',
5229   },
5230
5231   #more fine-grained, service def-level control could be useful eventually?
5232   {
5233     'key'         => 'svc_broadband-allow_null_ip_addr',
5234     'section'     => 'wireless_broadband',
5235     'description' => '',
5236     'type'        => 'checkbox',
5237   },
5238
5239   {
5240     'key'         => 'svc_hardware-check_mac_addr',
5241     'section'     => 'services',
5242     'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.',
5243     'type'        => 'checkbox',
5244   },
5245
5246   {
5247     'key'         => 'tax-report_groups',
5248     'section'     => 'taxation',
5249     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
5250     'type'        => 'textarea',
5251   },
5252
5253   {
5254     'key'         => 'tax-cust_exempt-groups',
5255     'section'     => 'taxation',
5256     'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line.  For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).',
5257     'type'        => 'textarea',
5258   },
5259
5260   {
5261     'key'         => 'tax-cust_exempt-groups-num_req',
5262     'section'     => 'taxation',
5263     'description' => 'When using tax-cust_exempt-groups, control whether individual tax exemption numbers are required for exemption from different taxes.',
5264     'type'        => 'select',
5265     'select_hash' => [ ''            => 'Not required',
5266                        'residential' => 'Required for residential customers only',
5267                        'all'         => 'Required for all customers',
5268                      ],
5269   },
5270
5271   {
5272     'key'         => 'tax-round_per_line_item',
5273     'section'     => 'taxation',
5274     'description' => 'Calculate tax and round to the nearest cent for each line item, rather than for the whole invoice.',
5275     'type'        => 'checkbox',
5276   },
5277
5278   {
5279     'key'         => 'cust_main-default_view',
5280     'section'     => 'UI',
5281     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
5282     'type'        => 'select',
5283     'select_hash' => [
5284       #false laziness w/view/cust_main.cgi and pref/pref.html
5285       'basics'          => 'Basics',
5286       'notes'           => 'Notes',
5287       'tickets'         => 'Tickets',
5288       'packages'        => 'Packages',
5289       'payment_history' => 'Payment History',
5290       'change_history'  => 'Change History',
5291       'jumbo'           => 'Jumbo',
5292     ],
5293   },
5294
5295   {
5296     'key'         => 'enable_tax_adjustments',
5297     'section'     => 'taxation',
5298     'description' => 'Enable the ability to add manual tax adjustments.',
5299     'type'        => 'checkbox',
5300   },
5301
5302   {
5303     'key'         => 'rt-crontool',
5304     'section'     => 'ticketing',
5305     'description' => 'Enable the RT CronTool extension.',
5306     'type'        => 'checkbox',
5307   },
5308
5309   {
5310     'key'         => 'pkg-balances',
5311     'section'     => 'packages',
5312     'description' => 'Enable per-package balances.',
5313     'type'        => 'checkbox',
5314   },
5315
5316   {
5317     'key'         => 'pkg-addon_classnum',
5318     'section'     => 'packages',
5319     'description' => 'Enable the ability to restrict additional package orders based on package class.',
5320     'type'        => 'checkbox',
5321   },
5322
5323   {
5324     'key'         => 'cust_main-edit_signupdate',
5325     'section'     => 'customer_fields',
5326     'description' => 'Enable manual editing of the signup date.',
5327     'type'        => 'checkbox',
5328   },
5329
5330   {
5331     'key'         => 'svc_acct-disable_access_number',
5332     'section'     => 'UI',
5333     'description' => 'Disable access number selection.',
5334     'type'        => 'checkbox',
5335   },
5336
5337   {
5338     'key'         => 'cust_bill_pay_pkg-manual',
5339     'section'     => 'UI',
5340     'description' => 'Allow manual application of payments to line items.',
5341     'type'        => 'checkbox',
5342   },
5343
5344   {
5345     'key'         => 'cust_credit_bill_pkg-manual',
5346     'section'     => 'UI',
5347     'description' => 'Allow manual application of credits to line items.',
5348     'type'        => 'checkbox',
5349   },
5350
5351   {
5352     'key'         => 'breakage-days',
5353     'section'     => 'billing',
5354     'description' => 'If set to a number of days, after an account goes that long without activity, recognizes any outstanding payments and credits as "breakage" by creating a breakage charge and invoice.',
5355     'type'        => 'text',
5356     'per_agent'   => 1,
5357   },
5358
5359   {
5360     'key'         => 'breakage-pkg_class',
5361     'section'     => 'billing',
5362     'description' => 'Package class to use for breakage reconciliation.',
5363     'type'        => 'select-pkg_class',
5364   },
5365
5366   {
5367     'key'         => 'disable_cron_billing',
5368     'section'     => 'billing',
5369     'description' => 'Disable billing and collection from being run by freeside-daily and freeside-monthly, while still allowing other actions to run, such as notifications and backup.',
5370     'type'        => 'checkbox',
5371   },
5372
5373   {
5374     'key'         => 'svc_domain-edit_domain',
5375     'section'     => 'services',
5376     'description' => 'Enable domain renaming',
5377     'type'        => 'checkbox',
5378   },
5379
5380   {
5381     'key'         => 'enable_legacy_prepaid_income',
5382     'section'     => 'reporting',
5383     'description' => "Enable legacy prepaid income reporting.  Only useful when you have imported pre-Freeside packages with longer-than-monthly duration, and need to do prepaid income reporting on them before they've been invoiced the first time.",
5384     'type'        => 'checkbox',
5385   },
5386
5387   {
5388     'key'         => 'cust_main-exports',
5389     'section'     => 'API',
5390     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
5391     'type'        => 'select-sub',
5392     'multiple'    => 1,
5393     'options_sub' => sub {
5394       require FS::Record;
5395       require FS::part_export;
5396       my @part_export =
5397         map { qsearch( 'part_export', {exporttype => $_ } ) }
5398           keys %{FS::part_export::export_info('cust_main')};
5399       map { $_->exportnum => $_->exportname } @part_export;
5400     },
5401     'option_sub'  => sub {
5402       require FS::Record;
5403       require FS::part_export;
5404       my $part_export = FS::Record::qsearchs(
5405         'part_export', { 'exportnum' => shift }
5406       );
5407       $part_export
5408         ? $part_export->exportname
5409         : '';
5410     },
5411   },
5412
5413   #false laziness w/above options_sub and option_sub
5414   {
5415     'key'         => 'cust_location-exports',
5416     'section'     => 'API',
5417     'description' => 'Export(s) to call on cust_location insert or modification',
5418     'type'        => 'select-sub',
5419     'multiple'    => 1,
5420     'options_sub' => sub {
5421       require FS::Record;
5422       require FS::part_export;
5423       my @part_export =
5424         map { qsearch( 'part_export', {exporttype => $_ } ) }
5425           keys %{FS::part_export::export_info('cust_location')};
5426       map { $_->exportnum => $_->exportname } @part_export;
5427     },
5428     'option_sub'  => sub {
5429       require FS::Record;
5430       require FS::part_export;
5431       my $part_export = FS::Record::qsearchs(
5432         'part_export', { 'exportnum' => shift }
5433       );
5434       $part_export
5435         ? $part_export->exportname
5436         : '';
5437     },
5438   },
5439
5440   {
5441     'key'         => 'cust_tag-location',
5442     'section'     => 'UI',
5443     'description' => 'Location where customer tags are displayed.',
5444     'type'        => 'select',
5445     'select_enum' => [ 'misc_info', 'top' ],
5446   },
5447
5448   {
5449     'key'         => 'cust_main-custom_link',
5450     'section'     => 'UI',
5451     'description' => 'URL to use as source for the "Custom" tab in the View Customer page.  The customer number will be appended, or you can insert "$custnum" to have it inserted elsewhere.  "$agentnum" will be replaced with the agent number, "$agent_custid" with be replaced with the agent customer ID (if any), and "$usernum" will be replaced with the employee number.',
5452     'type'        => 'textarea',
5453   },
5454
5455   {
5456     'key'         => 'cust_main-custom_content',
5457     'section'     => 'UI',
5458     'description' => 'As an alternative to cust_main-custom_link (leave it blank), the contant to display on this customer page, one item per line.  Available iems are: small_custview, birthdate, spouse_birthdate, svc_acct, svc_phone and svc_external.',
5459     'type'        => 'textarea',
5460   },
5461
5462   {
5463     'key'         => 'cust_main-custom_title',
5464     'section'     => 'UI',
5465     'description' => 'Title for the "Custom" tab in the View Customer page.',
5466     'type'        => 'text',
5467   },
5468
5469   {
5470     'key'         => 'part_pkg-default_suspend_bill',
5471     'section'     => 'suspension',
5472     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
5473     'type'        => 'checkbox',
5474   },
5475   
5476   {
5477     'key'         => 'qual-alt_address_format',
5478     'section'     => 'addresses',
5479     'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
5480     'type'        => 'checkbox',
5481   },
5482
5483   {
5484     'key'         => 'prospect_main-alt_address_format',
5485     'section'     => 'UI',
5486     'description' => 'Enable the alternate address format (location type, number, and kind) for prospects.  Recommended if qual-alt_address_format is set and the main use of propects is for qualifications.',
5487     'type'        => 'checkbox',
5488   },
5489
5490   {
5491     'key'         => 'prospect_main-location_required',
5492     'section'     => 'UI',
5493     'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
5494     'type'        => 'checkbox',
5495   },
5496
5497   {
5498     'key'         => 'note-classes',
5499     'section'     => 'deprecated',
5500     'description' => 'Use customer note classes (now automatically used if classes are defined)',
5501     'type'        => 'select',
5502     'select_hash' => [
5503                        0 => 'Disabled',
5504                        1 => 'Enabled',
5505                        2 => 'Enabled, with tabs',
5506                      ],
5507   },
5508
5509   {
5510     'key'         => 'svc_acct-cf_privatekey-message',
5511     'section'     => 'development',
5512     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
5513     'type'        => 'textarea',
5514   },
5515
5516   {
5517     'key'         => 'menu-prepend_links',
5518     'section'     => 'UI',
5519     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
5520     'type'        => 'textarea',
5521   },
5522
5523   {
5524     'key'         => 'cust_main-external_links',
5525     'section'     => 'UI',
5526     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
5527     'type'        => 'textarea',
5528   },
5529   
5530   {
5531     'key'         => 'svc_phone-did-summary',
5532     'section'     => 'telephony',
5533     'description' => 'Experimental feature to enable DID activity summary on invoices, showing # DIDs activated/deactivated/ported-in/ported-out and total minutes usage, covering period since last invoice.',
5534     'type'        => 'checkbox',
5535   },
5536
5537   {
5538     'key'         => 'svc_acct-usage_seconds',
5539     'section'     => 'RADIUS',
5540     'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
5541     'type'        => 'checkbox',
5542   },
5543   
5544   {
5545     'key'         => 'opensips_gwlist',
5546     'section'     => 'telephony',
5547     'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
5548     'type'        => 'text',
5549     'per_agent'   => 1,
5550     'agentonly'   => 1,
5551   },
5552
5553   {
5554     'key'         => 'opensips_description',
5555     'section'     => 'telephony',
5556     'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
5557     'type'        => 'text',
5558     'per_agent'   => 1,
5559     'agentonly'   => 1,
5560   },
5561   
5562   {
5563     'key'         => 'opensips_route',
5564     'section'     => 'telephony',
5565     'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
5566     'type'        => 'text',
5567     'per_agent'   => 1,
5568     'agentonly'   => 1,
5569   },
5570
5571   {
5572     'key'         => 'cust_bill-no_recipients-error',
5573     'section'     => 'invoice_email',
5574     'description' => 'For customers with no invoice recipients, throw a job queue error rather than the default behavior of emailing the invoice to the invoice_from address.',
5575     'type'        => 'checkbox',
5576   },
5577
5578   {
5579     'key'         => 'cust_bill-latex_lineitem_maxlength',
5580     'section'     => 'deprecated',
5581     'description' => 'With old invoice_latex template, truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  (With current invoice_latex template, this is handled internally in the template itself instead.)',
5582     'type'        => 'text',
5583   },
5584
5585   {
5586     'key'         => 'invoice_payment_details',
5587     'section'     => 'invoicing',
5588     'description' => 'When displaying payments on an invoice, show the payment method used, including the check or credit card number.  Credit card numbers will be masked.',
5589     'type'        => 'checkbox',
5590   },
5591
5592   {
5593     'key'         => 'cust_main-status_module',
5594     'section'     => 'UI',
5595     'description' => 'Which module to use for customer status display.  The "Classic" module (the default) considers accounts with cancelled recurring packages but un-cancelled one-time charges Inactive.  The "Recurring" module considers those customers Cancelled.  Similarly for customers with suspended recurring packages but one-time charges.  Restart Apache after changing.', #other differences?
5596     'type'        => 'select',
5597     'select_enum' => [ 'Classic', 'Recurring' ],
5598   },
5599
5600   { 
5601     'key'         => 'username-pound',
5602     'section'     => 'username',
5603     'description' => 'Allow the pound character (#) in usernames.',
5604     'type'        => 'checkbox',
5605   },
5606
5607   { 
5608     'key'         => 'username-exclamation',
5609     'section'     => 'username',
5610     'description' => 'Allow the exclamation character (!) in usernames.',
5611     'type'        => 'checkbox',
5612   },
5613
5614   {
5615     'key'         => 'disable_payauto_default',
5616     'section'     => 'payments',
5617     'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
5618     'type'        => 'checkbox',
5619   },
5620   
5621   {
5622     'key'         => 'payment-history-report',
5623     'section'     => 'deprecated',
5624     'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
5625     'type'        => 'checkbox',
5626   },
5627   
5628   {
5629     'key'         => 'cust-edit-alt-field-order',
5630     'section'     => 'customer_fields',
5631     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
5632     'type'        => 'checkbox',
5633   },
5634
5635   {
5636     'key'         => 'cust_bill-enable_promised_date',
5637     'section'     => 'UI',
5638     'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
5639     'type'        => 'checkbox',
5640   },
5641   
5642   {
5643     'key'         => 'available-locales',
5644     'section'     => 'localization',
5645     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
5646     'type'        => 'select-sub',
5647     'multiple'    => 1,
5648     'options_sub' => sub { 
5649       map { $_ => FS::Locales->description($_) }
5650       FS::Locales->locales;
5651     },
5652     'option_sub'  => sub { FS::Locales->description(shift) },
5653   },
5654
5655   {
5656     'key'         => 'cust_main-require_locale',
5657     'section'     => 'localization',
5658     'description' => 'Require an explicit locale to be chosen for new customers.',
5659     'type'        => 'checkbox',
5660   },
5661   
5662   {
5663     'key'         => 'translate-auto-insert',
5664     'section'     => 'localization',
5665     'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values.  Do not turn this on unless translating the interface into a new language.  Restart Apache after changing.',
5666     'type'        => 'select',
5667     'multiple'    => 1,
5668     'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
5669   },
5670
5671   {
5672     'key'         => 'svc_acct-tower_sector',
5673     'section'     => 'services',
5674     'description' => 'Track tower and sector for svc_acct (account) services.',
5675     'type'        => 'checkbox',
5676   },
5677
5678   {
5679     'key'         => 'cdr-prerate',
5680     'section'     => 'telephony',
5681     'description' => 'Experimental feature to rate CDRs immediately, rather than waiting until invoice generation time.  Can reduce invoice generation time when processing lots of CDRs.  Currently works with "VoIP/telco CDR rating (standard)" price plans using "Phone numbers (svc_phone.phonenum)" CDR service matching, without any included minutes.',
5682     'type'        => 'checkbox',
5683   },
5684
5685   {
5686     'key'         => 'cdr-prerate-cdrtypenums',
5687     'section'     => 'telephony',
5688     'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
5689     'type'        => 'select-sub',
5690     'multiple'    => 1,
5691     'options_sub' => sub { require FS::Record;
5692                            require FS::cdr_type;
5693                            map { $_->cdrtypenum => $_->cdrtypename }
5694                                FS::Record::qsearch( 'cdr_type', 
5695                                                     {} #{ 'disabled' => '' }
5696                                                   );
5697                          },
5698     'option_sub'  => sub { require FS::Record;
5699                            require FS::cdr_type;
5700                            my $cdr_type = FS::Record::qsearchs(
5701                              'cdr_type', { 'cdrtypenum'=>shift } );
5702                            $cdr_type ? $cdr_type->cdrtypename : '';
5703                          },
5704   },
5705
5706   {
5707     'key'         => 'cdr-minutes_priority',
5708     'section'     => 'telephony',
5709     'description' => 'Priority rule for assigning included minutes to CDRs.',
5710     'type'        => 'select',
5711     'select_hash' => [
5712       ''          => 'No specific order',
5713       'time'      => 'Chronological',
5714       'rate_high' => 'Highest rate first',
5715       'rate_low'  => 'Lowest rate first',
5716     ],
5717   },
5718
5719   {
5720     'key'         => 'cdr-lrn_lookup',
5721     'section'     => 'telephony',
5722     'description' => 'Look up LRNs of destination numbers for exact matching to the terminating carrier.  This feature requires a Freeside support contract for paid access to the central NPAC database; see <a href ="#support-key">support-key</a>.',
5723     'type'        => 'checkbox',
5724   },
5725   
5726   {
5727     'key'         => 'brand-agent',
5728     'section'     => 'UI',
5729     'description' => 'Brand the backoffice interface (currently Help->About) using the company_name, company_url and logo.png configuration settings of the selected agent.  Typically used when selling or bundling hosted access to the backoffice interface.  NOTE: The AGPL software license has specific requirements for source code availability in this situation.',
5730     'type'        => 'select-agent',
5731   },
5732
5733   {
5734     'key'         => 'cust_class-tax_exempt',
5735     'section'     => 'taxation',
5736     'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.',
5737     'type'        => 'checkbox',
5738   },
5739
5740   {
5741     'key'         => 'selfservice-billing_history-line_items',
5742     'section'     => 'self-service',
5743     'description' => 'Return line item billing detail for the self-service billing_history API call.',
5744     'type'        => 'checkbox',
5745   },
5746
5747   {
5748     'key'         => 'selfservice-default_cdr_format',
5749     'section'     => 'self-service',
5750     'description' => 'Format for showing outbound CDRs in self-service.  The per-package option overrides this.',
5751     'type'        => 'select',
5752     'select_hash' => \@cdr_formats,
5753   },
5754
5755   {
5756     'key'         => 'selfservice-default_inbound_cdr_format',
5757     'section'     => 'self-service',
5758     'description' => 'Format for showing inbound CDRs in self-service.  The per-package option overrides this.  Leave blank to avoid showing these CDRs.',
5759     'type'        => 'select',
5760     'select_hash' => \@cdr_formats,
5761   },
5762
5763   {
5764     'key'         => 'selfservice-hide_cdr_price',
5765     'section'     => 'self-service',
5766     'description' => 'Don\'t show the "Price" column on CDRs in self-service.',
5767     'type'        => 'checkbox',
5768   },
5769
5770   {
5771     'key'         => 'selfservice-enable_payment_without_balance',
5772     'section'     => 'self-service',
5773     'description' => 'Allow selfservice customers to make payments even if balance is zero or below (resulting in an unapplied payment and negative balance.)',
5774     'type'        => 'checkbox',
5775   },
5776
5777   {
5778     'key'         => 'selfservice-ACH_info_readonly',
5779     'section'     => 'self-service',
5780     'description' => 'make ACH on self service portal read only',
5781     'type'        => 'checkbox',
5782   },
5783
5784   {
5785     'key'         => 'selfservice-announcement',
5786     'section'     => 'self-service',
5787     'description' => 'HTML announcement to display to all authenticated users on account overview page',
5788     'type'        => 'textarea',
5789   },
5790
5791   {
5792     'key'         => 'logout-timeout',
5793     'section'     => 'deprecated',
5794     'description' => 'Deprecated.  Used to automatically log users out of the backoffice after this many minutes.  Set session timeouts in employee groups instead.',
5795     'type'       => 'text',
5796   },
5797   
5798   {
5799     'key'         => 'spreadsheet_format',
5800     'section'     => 'reporting',
5801     'description' => 'Default format for spreadsheet download.',
5802     'type'        => 'select',
5803     'select_hash' => [
5804       'XLS' => 'XLS (Excel 97/2000/XP)',
5805       'XLSX' => 'XLSX (Excel 2007+)',
5806     ],
5807   },
5808
5809   {
5810     'key'         => 'report-cust_pay-select_time',
5811     'section'     => 'reporting',
5812     'description' => 'Enable time selection on payment and refund reports.',
5813     'type'        => 'checkbox',
5814   },
5815
5816   {
5817     'key'         => 'authentication_module',
5818     'section'     => 'UI',
5819     'description' => '"Internal" is the default , which authenticates against the internal database.  "Legacy" is similar, but matches passwords against a legacy htpasswd file.',
5820     'type'        => 'select',
5821     'select_enum' => [qw( Internal Legacy )],
5822   },
5823
5824   {
5825     'key'         => 'external_auth-access_group-template_user',
5826     'section'     => 'UI',
5827     'description' => 'When using an external authentication module, specifies the default access groups for autocreated users, via a template user.',
5828     'type'        => 'text',
5829   },
5830
5831   {
5832     'key'         => 'allow_invalid_cards',
5833     'section'     => 'development',
5834     'description' => 'Accept invalid credit card numbers.  Useful for testing with fictitious customers.  There is no good reason to enable this in production.',
5835     'type'        => 'checkbox',
5836   },
5837
5838   {
5839     'key'         => 'default_credit_limit',
5840     'section'     => 'billing',
5841     'description' => 'Default customer credit limit',
5842     'type'        => 'text',
5843   },
5844
5845   {
5846     'key'         => 'api_shared_secret',
5847     'section'     => 'API',
5848     'description' => 'Shared secret for back-office API authentication',
5849     'type'        => 'text',
5850   },
5851
5852   {
5853     'key'         => 'xmlrpc_api',
5854     'section'     => 'API',
5855     'description' => 'Enable the back-office API XML-RPC server (on port 8008).',
5856     'type'        => 'checkbox',
5857   },
5858
5859 #  {
5860 #    'key'         => 'jsonrpc_api',
5861 #    'section'     => 'API',
5862 #    'description' => 'Enable the back-office API JSON-RPC server (on port 8081).',
5863 #    'type'        => 'checkbox',
5864 #  },
5865
5866   {
5867     'key'         => 'api_credit_reason',
5868     'section'     => 'API',
5869     'description' => 'Default reason for back-office API credits',
5870     'type'        => 'select-sub',
5871     #false laziness w/api_credit_reason
5872     'options_sub' => sub { require FS::Record;
5873                            require FS::reason;
5874                            my $type = qsearchs('reason_type', 
5875                              { class => 'R' }) 
5876                               or return ();
5877                            map { $_->reasonnum => $_->reason }
5878                                FS::Record::qsearch('reason', 
5879                                  { reason_type => $type->typenum } 
5880                                );
5881                          },
5882     'option_sub'  => sub { require FS::Record;
5883                            require FS::reason;
5884                            my $reason = FS::Record::qsearchs(
5885                              'reason', { 'reasonnum' => shift }
5886                            );
5887                            $reason ? $reason->reason : '';
5888                          },
5889   },
5890
5891   {
5892     'key'         => 'part_pkg-term_discounts',
5893     'section'     => 'packages',
5894     'description' => 'Enable the term discounts feature.  Recommended to keep turned off unless actually using - not well optimized for large installations.',
5895     'type'        => 'checkbox',
5896   },
5897
5898   {
5899     'key'         => 'prepaid-never_renew',
5900     'section'     => 'packages',
5901     'description' => 'Prepaid packages never renew.',
5902     'type'        => 'checkbox',
5903   },
5904
5905   {
5906     'key'         => 'agent-disable_counts',
5907     'section'     => 'scalability',
5908     'description' => 'On the agent browse page, disable the customer and package counts.  Typically used for very large installs when this page takes too long to render.',
5909     'type'        => 'checkbox',
5910   },
5911
5912   {
5913     'key'         => 'tollfree-country',
5914     'section'     => 'telephony',
5915     'description' => 'Country / region for toll-free recognition',
5916     'type'        => 'select',
5917     'select_hash' => [ ''   => 'NANPA (US/Canada)',
5918                        'AU' => 'Australia',
5919                        'NZ' => 'New Zealand',
5920                      ],
5921   },
5922
5923   {
5924     'key'         => 'old_fcc_report',
5925     'section'     => 'deprecated',
5926     'description' => 'Use the old (pre-2014) FCC Form 477 report format.',
5927     'type'        => 'checkbox',
5928   },
5929
5930   {
5931     'key'         => 'cust_main-default_commercial',
5932     'section'     => 'customer_fields',
5933     'description' => 'Default for new customers is commercial rather than residential.',
5934     'type'        => 'checkbox',
5935   },
5936
5937   {
5938     'key'         => 'default_appointment_length',
5939     'section'     => 'appointments',
5940     'description' => 'Default appointment length, in minutes (30 minute granularity).',
5941     'type'        => 'text',
5942   },
5943
5944   {
5945     'key'         => 'selfservice-db_profile',
5946     'section'     => 'development',
5947     'description' => 'Enable collection and logging of database profiling information for self-service servers.  This has significant overhead, do not leave enabled in production beyond that necessary to collect profiling data.',
5948     'type'        => 'checkbox',
5949   },
5950
5951
5952   # for internal use only; test databases should declare this option and
5953   # everyone else should pretend it doesn't exist
5954   #{
5955   #  'key'         => 'no_random_ids',
5956   #  'section'     => '',
5957   #  'description' => 'Replace random identifiers in UI code with a static string, for repeatable testing. Don\'t use in production.',
5958   #  'type'        => 'checkbox',
5959   #},
5960
5961 );
5962
5963 1;
5964