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