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