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