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