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