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