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