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