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