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