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