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