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