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