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