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