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