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