72456: Directions - override company_address
[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'         => 'google_maps_api_key',
2230     'section'     => 'UI',
2231     'description' => 'API key for google maps.  This must be set for map and directions links to work.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_top">Getting a Google Maps API Key</a>',
2232     'type'        => 'text',
2233   },
2234
2235   {
2236     'key'         => 'company_physical_address',
2237     'section'     => 'addresses',
2238     'description' => 'Your physical company address, for use in supplying google map directions, defaults to company_address',
2239     'type'        => 'textarea',
2240     'per_agent'   => 1,
2241   },
2242
2243   {
2244     'key'         => 'show_ship_company',
2245     'section'     => 'UI',
2246     'description' => 'Turns on display/collection of a "service company name" field for customers.',
2247     'type'        => 'checkbox',
2248   },
2249
2250   {
2251     'key'         => 'show_ss',
2252     'section'     => 'UI',
2253     'description' => 'Turns on display/collection of social security numbers in the web interface.  Sometimes required by electronic check (ACH) processors.',
2254     'type'        => 'checkbox',
2255   },
2256
2257   {
2258     'key'         => 'unmask_ss',
2259     'section'     => 'UI',
2260     'description' => "Don't mask social security numbers in the web interface.",
2261     'type'        => 'checkbox',
2262   },
2263
2264   {
2265     'key'         => 'show_stateid',
2266     'section'     => 'UI',
2267     'description' => "Turns on display/collection of driver's license/state issued id numbers in the web interface.  Sometimes required by electronic check (ACH) processors.",
2268     'type'        => 'checkbox',
2269   },
2270
2271   {
2272     'key'         => 'national_id-country',
2273     'section'     => 'UI',
2274     'description' => 'Track a national identification number, for specific countries.',
2275     'type'        => 'select',
2276     'select_enum' => [ '', 'MY' ],
2277   },
2278
2279   {
2280     'key'         => 'show_bankstate',
2281     'section'     => 'UI',
2282     'description' => "Turns on display/collection of state for bank accounts in the web interface.  Sometimes required by electronic check (ACH) processors.",
2283     'type'        => 'checkbox',
2284   },
2285
2286   { 
2287     'key'         => 'agent_defaultpkg',
2288     'section'     => 'UI',
2289     'description' => 'Setting this option will cause new packages to be available to all agent types by default.',
2290     'type'        => 'checkbox',
2291   },
2292
2293   {
2294     'key'         => 'legacy_link',
2295     'section'     => 'UI',
2296     'description' => 'Display options in the web interface to link legacy pre-Freeside services.',
2297     'type'        => 'checkbox',
2298   },
2299
2300   {
2301     'key'         => 'legacy_link-steal',
2302     'section'     => 'UI',
2303     'description' => 'Allow "stealing" an already-audited service from one customer (or package) to another using the link function.',
2304     'type'        => 'checkbox',
2305   },
2306
2307   {
2308     'key'         => 'queue_dangerous_controls',
2309     'section'     => 'UI',
2310     '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.',
2311     'type'        => 'checkbox',
2312   },
2313
2314   {
2315     'key'         => 'security_phrase',
2316     'section'     => 'password',
2317     'description' => 'Enable the tracking of a "security phrase" with each account.  Not recommended, as it is vulnerable to social engineering.',
2318     'type'        => 'checkbox',
2319   },
2320
2321   {
2322     'key'         => 'locale',
2323     'section'     => 'UI',
2324     'description' => 'Default locale',
2325     'type'        => 'select-sub',
2326     'options_sub' => sub {
2327       map { $_ => FS::Locales->description($_) } FS::Locales->locales;
2328     },
2329     'option_sub'  => sub {
2330       FS::Locales->description(shift)
2331     },
2332   },
2333
2334   {
2335     'key'         => 'signup_server-payby',
2336     'section'     => 'self-service',
2337     'description' => 'Acceptable payment types for the signup server',
2338     'type'        => 'selectmultiple',
2339     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB PREPAY PPAL BILL COMP) ],
2340   },
2341
2342   {
2343     'key'         => 'selfservice-payment_gateway',
2344     'section'     => 'self-service',
2345     'description' => 'Force the use of this payment gateway for self-service.',
2346     %payment_gateway_options,
2347   },
2348
2349   {
2350     'key'         => 'selfservice-save_unchecked',
2351     'section'     => 'self-service',
2352     'description' => 'In self-service, uncheck "Remember information" checkboxes by default (normally, they are checked by default).',
2353     'type'        => 'checkbox',
2354   },
2355
2356   {
2357     'key'         => 'default_agentnum',
2358     'section'     => 'UI',
2359     'description' => 'Default agent for the backoffice',
2360     'type'        => 'select-agent',
2361   },
2362
2363   {
2364     'key'         => 'signup_server-default_agentnum',
2365     'section'     => 'self-service',
2366     'description' => 'Default agent for the signup server',
2367     'type'        => 'select-agent',
2368   },
2369
2370   {
2371     'key'         => 'signup_server-default_refnum',
2372     'section'     => 'self-service',
2373     'description' => 'Default advertising source for the signup server',
2374     'type'        => 'select-sub',
2375     'options_sub' => sub { require FS::Record;
2376                            require FS::part_referral;
2377                            map { $_->refnum => $_->referral }
2378                                FS::Record::qsearch( 'part_referral', 
2379                                                     { 'disabled' => '' }
2380                                                   );
2381                          },
2382     'option_sub'  => sub { require FS::Record;
2383                            require FS::part_referral;
2384                            my $part_referral = FS::Record::qsearchs(
2385                              'part_referral', { 'refnum'=>shift } );
2386                            $part_referral ? $part_referral->referral : '';
2387                          },
2388   },
2389
2390   {
2391     'key'         => 'signup_server-default_pkgpart',
2392     'section'     => 'self-service',
2393     'description' => 'Default package for the signup server',
2394     'type'        => 'select-part_pkg',
2395   },
2396
2397   {
2398     'key'         => 'signup_server-default_svcpart',
2399     'section'     => 'self-service',
2400     'description' => 'Default service definition for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning or domain selection).',
2401     'type'        => 'select-part_svc',
2402   },
2403
2404   {
2405     'key'         => 'signup_server-default_domsvc',
2406     'section'     => 'self-service',
2407     'description' => 'If specified, the default domain svcpart for signup (useful when domain is set to selectable choice).',
2408     'type'        => 'text',
2409   },
2410
2411   {
2412     'key'         => 'signup_server-mac_addr_svcparts',
2413     'section'     => 'self-service',
2414     'description' => 'Service definitions which can receive mac addresses (current mapped to username for svc_acct).',
2415     'type'        => 'select-part_svc',
2416     'multiple'    => 1,
2417   },
2418
2419   {
2420     'key'         => 'signup_server-nomadix',
2421     'section'     => 'self-service',
2422     'description' => 'Signup page Nomadix integration',
2423     'type'        => 'checkbox',
2424   },
2425
2426   {
2427     'key'         => 'signup_server-service',
2428     'section'     => 'self-service',
2429     'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup',
2430     'type'        => 'select',
2431     'select_hash' => [
2432                        'svc_acct'  => 'Account (svc_acct)',
2433                        'svc_phone' => 'Phone number (svc_phone)',
2434                        'svc_pbx'   => 'PBX (svc_pbx)',
2435                        'none'      => 'None - package only',
2436                      ],
2437   },
2438   
2439   {
2440     'key'         => 'signup_server-prepaid-template-custnum',
2441     'section'     => 'self-service',
2442     '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',
2443     'type'        => 'text',
2444   },
2445
2446   {
2447     'key'         => 'signup_server-terms_of_service',
2448     'section'     => 'self-service',
2449     'description' => 'Terms of Service for the signup server.  May contain HTML.',
2450     'type'        => 'textarea',
2451     'per_agent'   => 1,
2452   },
2453
2454   {
2455     'key'         => 'selfservice_server-base_url',
2456     'section'     => 'self-service',
2457     '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.',
2458     'type'        => 'text',
2459   },
2460
2461   {
2462     'key'         => 'show-msgcat-codes',
2463     'section'     => 'UI',
2464     'description' => 'Show msgcat codes in error messages.  Turn this option on before reporting errors to the mailing list.',
2465     'type'        => 'checkbox',
2466   },
2467
2468   {
2469     'key'         => 'signup_server-realtime',
2470     'section'     => 'self-service',
2471     'description' => 'Run billing for signup server signups immediately, and do not provision accounts which subsequently have a balance.',
2472     'type'        => 'checkbox',
2473   },
2474
2475   {
2476     'key'         => 'signup_server-classnum2',
2477     'section'     => 'self-service',
2478     'description' => 'Package Class for first optional purchase',
2479     'type'        => 'select-pkg_class',
2480   },
2481
2482   {
2483     'key'         => 'signup_server-classnum3',
2484     'section'     => 'self-service',
2485     'description' => 'Package Class for second optional purchase',
2486     'type'        => 'select-pkg_class',
2487   },
2488
2489   {
2490     'key'         => 'signup_server-third_party_as_card',
2491     'section'     => 'self-service',
2492     'description' => 'Allow customer payment type to be set to CARD even when using third-party credit card billing.',
2493     'type'        => 'checkbox',
2494   },
2495
2496   {
2497     'key'         => 'selfservice-xmlrpc',
2498     'section'     => 'self-service',
2499     'description' => 'Run a standalone self-service XML-RPC server on the backend (on port 8080).',
2500     'type'        => 'checkbox',
2501   },
2502
2503   {
2504     'key'         => 'selfservice-timeout',
2505     'section'     => 'self-service',
2506     'description' => 'Timeout for the self-service login cookie, in seconds.  Defaults to 1 hour.',
2507     'type'        => 'text',
2508   },
2509
2510   {
2511     'key'         => 'backend-realtime',
2512     'section'     => 'billing',
2513     'description' => 'Run billing for backend signups immediately.',
2514     'type'        => 'checkbox',
2515   },
2516
2517   {
2518     'key'         => 'decline_msgnum',
2519     'section'     => 'notification',
2520     'description' => 'Template to use for credit card and electronic check decline messages.',
2521     %msg_template_options,
2522   },
2523
2524   {
2525     'key'         => 'declinetemplate',
2526     'section'     => 'deprecated',
2527     'description' => 'Template file for credit card and electronic check decline emails.',
2528     'type'        => 'textarea',
2529   },
2530
2531   {
2532     'key'         => 'emaildecline',
2533     'section'     => 'notification',
2534     'description' => 'Enable emailing of credit card and electronic check decline notices.',
2535     'type'        => 'checkbox',
2536     'per_agent'   => 1,
2537   },
2538
2539   {
2540     'key'         => 'emaildecline-exclude',
2541     'section'     => 'notification',
2542     'description' => 'List of error messages that should not trigger email decline notices, one per line.',
2543     'type'        => 'textarea',
2544     'per_agent'   => 1,
2545   },
2546
2547   {
2548     'key'         => 'cancel_msgnum',
2549     'section'     => 'notification',
2550     'description' => 'Template to use for cancellation emails.',
2551     %msg_template_options,
2552   },
2553
2554   {
2555     'key'         => 'cancelmessage',
2556     'section'     => 'deprecated',
2557     'description' => 'Template file for cancellation emails.',
2558     'type'        => 'textarea',
2559   },
2560
2561   {
2562     'key'         => 'cancelsubject',
2563     'section'     => 'deprecated',
2564     'description' => 'Subject line for cancellation emails.',
2565     'type'        => 'text',
2566   },
2567
2568   {
2569     'key'         => 'emailcancel',
2570     'section'     => 'notification',
2571     'description' => 'Enable emailing of cancellation notices.  Make sure to select the template in the cancel_msgnum option.',
2572     'type'        => 'checkbox',
2573     'per_agent'   => 1,
2574   },
2575
2576   {
2577     'key'         => 'bill_usage_on_cancel',
2578     'section'     => 'billing',
2579     '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.',
2580     'type'        => 'checkbox',
2581   },
2582
2583   {
2584     'key'         => 'require_cardname',
2585     'section'     => 'billing',
2586     'description' => 'Require an "Exact name on card" to be entered explicitly; don\'t default to using the first and last name.',
2587     'type'        => 'checkbox',
2588   },
2589
2590   {
2591     'key'         => 'enable_taxclasses',
2592     'section'     => 'billing',
2593     'description' => 'Enable per-package tax classes',
2594     'type'        => 'checkbox',
2595   },
2596
2597   {
2598     'key'         => 'require_taxclasses',
2599     'section'     => 'billing',
2600     'description' => 'Require a taxclass to be entered for every package',
2601     'type'        => 'checkbox',
2602   },
2603
2604   {
2605     'key'         => 'enable_taxproducts',
2606     'section'     => 'billing',
2607     'description' => 'Enable per-package mapping to vendor tax data from CCH or elsewhere.',
2608     'type'        => 'checkbox',
2609   },
2610
2611   {
2612     'key'         => 'taxdatadirectdownload',
2613     'section'     => 'billing',  #well
2614     'description' => 'Enable downloading tax data directly from the vendor site. at least three lines: URL, username, and password.j',
2615     'type'        => 'textarea',
2616   },
2617
2618   {
2619     'key'         => 'ignore_incalculable_taxes',
2620     'section'     => 'billing',
2621     'description' => 'Prefer to invoice without tax over not billing at all',
2622     'type'        => 'checkbox',
2623   },
2624
2625   {
2626     'key'         => 'welcome_msgnum',
2627     'section'     => 'notification',
2628     'description' => 'Template to use for welcome messages when a svc_acct record is created.',
2629     %msg_template_options,
2630   },
2631   
2632   {
2633     'key'         => 'svc_acct_welcome_exclude',
2634     'section'     => 'notification',
2635     'description' => 'A list of svc_acct services for which no welcome email is to be sent.',
2636     'type'        => 'select-part_svc',
2637     'multiple'    => 1,
2638   },
2639
2640   {
2641     'key'         => 'welcome_email',
2642     'section'     => 'deprecated',
2643     '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.',
2644     'type'        => 'textarea',
2645     'per_agent'   => 1,
2646   },
2647
2648   {
2649     'key'         => 'welcome_email-from',
2650     'section'     => 'deprecated',
2651     'description' => 'From: address header for welcome email',
2652     'type'        => 'text',
2653     'per_agent'   => 1,
2654   },
2655
2656   {
2657     'key'         => 'welcome_email-subject',
2658     'section'     => 'deprecated',
2659     'description' => 'Subject: header for welcome email',
2660     'type'        => 'text',
2661     'per_agent'   => 1,
2662   },
2663   
2664   {
2665     'key'         => 'welcome_email-mimetype',
2666     'section'     => 'deprecated',
2667     'description' => 'MIME type for welcome email',
2668     'type'        => 'select',
2669     'select_enum' => [ 'text/plain', 'text/html' ],
2670     'per_agent'   => 1,
2671   },
2672
2673   {
2674     'key'         => 'welcome_letter',
2675     'section'     => '',
2676     '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>',
2677     'type'        => 'textarea',
2678   },
2679
2680 #  {
2681 #    'key'         => 'warning_msgnum',
2682 #    'section'     => 'notification',
2683 #    '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.',
2684 #    %msg_template_options,
2685 #  },
2686
2687   {
2688     'key'         => 'warning_email',
2689     'section'     => 'notification',
2690     '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>',
2691     'type'        => 'textarea',
2692   },
2693
2694   {
2695     'key'         => 'warning_email-from',
2696     'section'     => 'notification',
2697     'description' => 'From: address header for warning email',
2698     'type'        => 'text',
2699   },
2700
2701   {
2702     'key'         => 'warning_email-cc',
2703     'section'     => 'notification',
2704     'description' => 'Additional recipient(s) (comma separated) for warning email when remaining usage reaches zero.',
2705     'type'        => 'text',
2706   },
2707
2708   {
2709     'key'         => 'warning_email-subject',
2710     'section'     => 'notification',
2711     'description' => 'Subject: header for warning email',
2712     'type'        => 'text',
2713   },
2714   
2715   {
2716     'key'         => 'warning_email-mimetype',
2717     'section'     => 'notification',
2718     'description' => 'MIME type for warning email',
2719     'type'        => 'select',
2720     'select_enum' => [ 'text/plain', 'text/html' ],
2721   },
2722
2723   {
2724     'key'         => 'payby',
2725     'section'     => 'billing',
2726     'description' => 'Available payment types.',
2727     'type'        => 'selectmultiple',
2728     'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD MCHK PPAL COMP) ],
2729   },
2730
2731   {
2732     'key'         => 'payby-default',
2733     'section'     => 'UI',
2734     'description' => 'Default payment type.  HIDE disables display of billing information and sets customers to BILL.',
2735     'type'        => 'select',
2736     'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST MCRD PPAL COMP HIDE) ],
2737   },
2738
2739   {
2740     'key'         => 'require_cash_deposit_info',
2741     'section'     => 'billing',
2742     'description' => 'When recording cash payments, display bank deposit information fields.',
2743     'type'        => 'checkbox',
2744   },
2745
2746   {
2747     'key'         => 'paymentforcedtobatch',
2748     'section'     => 'deprecated',
2749     '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.',
2750     'type'        => 'checkbox',
2751   },
2752
2753   {
2754     'key'         => 'svc_acct-notes',
2755     'section'     => 'deprecated',
2756     'description' => 'Extra HTML to be displayed on the Account View screen.',
2757     'type'        => 'textarea',
2758   },
2759
2760   {
2761     'key'         => 'radius-password',
2762     'section'     => '',
2763     'description' => 'RADIUS attribute for plain-text passwords.',
2764     'type'        => 'select',
2765     'select_enum' => [ 'Password', 'User-Password', 'Cleartext-Password' ],
2766   },
2767
2768   {
2769     'key'         => 'radius-ip',
2770     'section'     => '',
2771     'description' => 'RADIUS attribute for IP addresses.',
2772     'type'        => 'select',
2773     'select_enum' => [ 'Framed-IP-Address', 'Framed-Address' ],
2774   },
2775
2776   #http://dev.coova.org/svn/coova-chilli/doc/dictionary.chillispot
2777   {
2778     'key'         => 'radius-chillispot-max',
2779     'section'     => '',
2780     'description' => 'Enable ChilliSpot (and CoovaChilli) Max attributes, specifically ChilliSpot-Max-{Input,Output,Total}-{Octets,Gigawords}.',
2781     'type'        => 'checkbox',
2782   },
2783
2784   {
2785     'key'         => 'radius-canopy',
2786     'section'     => '',
2787     'description' => 'Enable RADIUS attributes for Cambium (formerly Motorola) Canopy (Motorola-Canopy-Gateway).',
2788     'type'        => 'checkbox',
2789   },
2790
2791   {
2792     'key'         => 'svc_broadband-radius',
2793     'section'     => '',
2794     'description' => 'Enable RADIUS groups for broadband services.',
2795     'type'        => 'checkbox',
2796   },
2797
2798   {
2799     'key'         => 'svc_acct-alldomains',
2800     'section'     => '',
2801     '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.',
2802     'type'        => 'checkbox',
2803   },
2804
2805   {
2806     'key'         => 'dump-localdest',
2807     'section'     => '',
2808     'description' => 'Destination for local database dumps (full path)',
2809     'type'        => 'text',
2810   },
2811
2812   {
2813     'key'         => 'dump-scpdest',
2814     'section'     => '',
2815     'description' => 'Destination for scp database dumps: user@host:/path',
2816     'type'        => 'text',
2817   },
2818
2819   {
2820     'key'         => 'dump-pgpid',
2821     'section'     => '',
2822     '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.",
2823     'type'        => 'text',
2824   },
2825
2826   {
2827     'key'         => 'dump-email_to',
2828     'section'     => '',
2829     'description' => "Optional email address to send success/failure message for database dumps.",
2830     'type'        => 'text',
2831     'validate'    => $validate_email,
2832   },
2833
2834   {
2835     'key'         => 'users-allow_comp',
2836     'section'     => 'deprecated',
2837     '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.',
2838     'type'        => 'textarea',
2839   },
2840
2841   {
2842     'key'         => 'credit_card-recurring_billing_flag',
2843     'section'     => 'billing',
2844     '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. ',
2845     'type'        => 'select',
2846     'select_hash' => [
2847                        'actual_oncard' => 'Default/classic behavior: set the flag if a customer has actual previous charges on the card.',
2848                        'transaction_is_recur' => 'Set the flag if the transaction itself is recurring, irregardless of previous charges on the card.',
2849                      ],
2850   },
2851
2852   {
2853     'key'         => 'credit_card-recurring_billing_acct_code',
2854     'section'     => 'billing',
2855     'description' => 'When the "recurring billing" flag is set, also set the "acct_code" to "rebill".  Useful for reporting purposes with supported gateways (PlugNPay, others?)',
2856     'type'        => 'checkbox',
2857   },
2858
2859   {
2860     'key'         => 'cvv-save',
2861     'section'     => 'billing',
2862     '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.',
2863     'type'        => 'selectmultiple',
2864     'select_enum' => \@card_types,
2865   },
2866
2867   {
2868     'key'         => 'signup-require_cvv',
2869     'section'     => 'self-service',
2870     'description' => 'Require CVV for credit card signup.',
2871     'type'        => 'checkbox',
2872   },
2873
2874   {
2875     'key'         => 'backoffice-require_cvv',
2876     'section'     => 'billing',
2877     'description' => 'Require CVV for manual credit card entry.',
2878     'type'        => 'checkbox',
2879   },
2880
2881   {
2882     'key'         => 'selfservice-onfile_require_cvv',
2883     'section'     => 'self-service',
2884     'description' => 'Require CVV for on-file credit card during self-service payments.',
2885     'type'        => 'checkbox',
2886   },
2887
2888   {
2889     'key'         => 'selfservice-require_cvv',
2890     'section'     => 'self-service',
2891     'description' => 'Require CVV for credit card self-service payments, except for cards on-file.',
2892     'type'        => 'checkbox',
2893   },
2894
2895   {
2896     'key'         => 'manual_process-single_invoice_amount',
2897     'section'     => 'billing',
2898     'description' => 'When entering manual credit card and ACH payments, amount will not autofill if the customer has more than one open invoice',
2899     'type'        => 'checkbox',
2900   },
2901
2902   {
2903     'key'         => 'manual_process-pkgpart',
2904     'section'     => 'billing',
2905     '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.',
2906     'type'        => 'select-part_pkg',
2907     'per_agent'   => 1,
2908   },
2909
2910   {
2911     'key'         => 'manual_process-display',
2912     'section'     => 'billing',
2913     'description' => 'When using manual_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2914     'type'        => 'select',
2915     'select_hash' => [
2916                        'add'      => 'Add fee to amount entered',
2917                        'subtract' => 'Subtract fee from amount entered',
2918                      ],
2919   },
2920
2921   {
2922     'key'         => 'manual_process-skip_first',
2923     'section'     => 'billing',
2924     'description' => "When using manual_process-pkgpart, omit the fee if it is the customer's first payment.",
2925     'type'        => 'checkbox',
2926   },
2927
2928   {
2929     'key'         => 'selfservice_immutable-package',
2930     'section'     => 'self-service',
2931     'description' => 'Disable package changes in self-service interface.',
2932     'type'        => 'checkbox',
2933     'per_agent'   => 1,
2934   },
2935
2936   {
2937     'key'         => 'selfservice_hide-usage',
2938     'section'     => 'self-service',
2939     'description' => 'Hide usage data in self-service interface.',
2940     'type'        => 'checkbox',
2941     'per_agent'   => 1,
2942   },
2943
2944   {
2945     'key'         => 'selfservice_process-pkgpart',
2946     'section'     => 'billing',
2947     '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.',
2948     'type'        => 'select-part_pkg',
2949     'per_agent'   => 1,
2950   },
2951
2952   {
2953     'key'         => 'selfservice_process-display',
2954     'section'     => 'billing',
2955     'description' => 'When using selfservice_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2956     'type'        => 'select',
2957     'select_hash' => [
2958                        'add'      => 'Add fee to amount entered',
2959                        'subtract' => 'Subtract fee from amount entered',
2960                      ],
2961   },
2962
2963   {
2964     'key'         => 'selfservice_process-skip_first',
2965     'section'     => 'billing',
2966     'description' => "When using selfservice_process-pkgpart, omit the fee if it is the customer's first payment.",
2967     'type'        => 'checkbox',
2968   },
2969
2970 #  {
2971 #    'key'         => 'auto_process-pkgpart',
2972 #    'section'     => 'billing',
2973 #    '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.',
2974 #    'type'        => 'select-part_pkg',
2975 #  },
2976 #
2977 ##  {
2978 ##    'key'         => 'auto_process-display',
2979 ##    'section'     => 'billing',
2980 ##    'description' => 'When using auto_process-pkgpart, add the fee to the amount entered (default), or subtract the fee from the amount entered.',
2981 ##    'type'        => 'select',
2982 ##    'select_hash' => [
2983 ##                       'add'      => 'Add fee to amount entered',
2984 ##                       'subtract' => 'Subtract fee from amount entered',
2985 ##                     ],
2986 ##  },
2987 #
2988 #  {
2989 #    'key'         => 'auto_process-skip_first',
2990 #    'section'     => 'billing',
2991 #    'description' => "When using auto_process-pkgpart, omit the fee if it is the customer's first payment.",
2992 #    'type'        => 'checkbox',
2993 #  },
2994
2995   {
2996     'key'         => 'allow_negative_charges',
2997     'section'     => 'billing',
2998     'description' => 'Allow negative charges.  Normally not used unless importing data from a legacy system that requires this.',
2999     'type'        => 'checkbox',
3000   },
3001   {
3002       'key'         => 'auto_unset_catchall',
3003       'section'     => '',
3004       '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.',
3005       'type'        => 'checkbox',
3006   },
3007
3008   {
3009     'key'         => 'system_usernames',
3010     'section'     => 'username',
3011     '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.',
3012     'type'        => 'textarea',
3013   },
3014
3015   {
3016     'key'         => 'cust_pkg-change_svcpart',
3017     'section'     => '',
3018     'description' => "When changing packages, move services even if svcparts don't match between old and new pacakge definitions.",
3019     'type'        => 'checkbox',
3020   },
3021
3022   {
3023     'key'         => 'cust_pkg-change_pkgpart-bill_now',
3024     'section'     => '',
3025     '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.",
3026     'type'        => 'checkbox',
3027   },
3028
3029   {
3030     'key'         => 'disable_autoreverse',
3031     'section'     => 'BIND',
3032     'description' => 'Disable automatic synchronization of reverse-ARPA entries.',
3033     'type'        => 'checkbox',
3034   },
3035
3036   {
3037     'key'         => 'svc_www-enable_subdomains',
3038     'section'     => '',
3039     'description' => 'Enable selection of specific subdomains for virtual host creation.',
3040     'type'        => 'checkbox',
3041   },
3042
3043   {
3044     'key'         => 'svc_www-usersvc_svcpart',
3045     'section'     => '',
3046     'description' => 'Allowable service definition svcparts for virtual hosts, one per line.',
3047     'type'        => 'select-part_svc',
3048     'multiple'    => 1,
3049   },
3050
3051   {
3052     'key'         => 'selfservice_server-primary_only',
3053     'section'     => 'self-service',
3054     'description' => 'Only allow primary accounts to access self-service functionality.',
3055     'type'        => 'checkbox',
3056   },
3057
3058   {
3059     'key'         => 'selfservice_server-phone_login',
3060     'section'     => 'self-service',
3061     'description' => 'Allow login to self-service with phone number and PIN.',
3062     'type'        => 'checkbox',
3063   },
3064
3065   {
3066     'key'         => 'selfservice_server-single_domain',
3067     'section'     => 'self-service',
3068     'description' => 'If specified, only use this one domain for self-service access.',
3069     'type'        => 'text',
3070   },
3071
3072   {
3073     'key'         => 'selfservice_server-login_svcpart',
3074     'section'     => 'self-service',
3075     'description' => 'If specified, only allow the specified svcparts to login to self-service.',
3076     'type'        => 'select-part_svc',
3077     'multiple'    => 1,
3078   },
3079
3080   {
3081     'key'         => 'selfservice-svc_forward_svcpart',
3082     'section'     => 'self-service',
3083     'description' => 'Service for self-service forward editing.',
3084     'type'        => 'select-part_svc',
3085   },
3086
3087   {
3088     'key'         => 'selfservice-password_reset_verification',
3089     'section'     => 'self-service',
3090     'description' => 'If enabled, specifies the type of verification required for self-service password resets.',
3091     'type'        => 'select',
3092     'select_hash' => [ '' => 'Password reset disabled',
3093                        'email' => 'Click on a link in email',
3094                        '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',
3095                      ],
3096   },
3097
3098   {
3099     'key'         => 'selfservice-password_reset_msgnum',
3100     'section'     => 'self-service',
3101     'description' => 'Template to use for password reset emails.',
3102     %msg_template_options,
3103   },
3104
3105   {
3106     'key'         => 'selfservice-password_change_oldpass',
3107     'section'     => 'self-service',
3108     'description' => 'Require old password to be entered again for password changes (in addition to being logged in), at the API level.',
3109     'type'        => 'checkbox',
3110   },
3111
3112   {
3113     'key'         => 'selfservice-hide_invoices-taxclass',
3114     'section'     => 'self-service',
3115     '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.',
3116     'type'        => 'text',
3117   },
3118
3119   {
3120     'key'         => 'selfservice-recent-did-age',
3121     'section'     => 'self-service',
3122     'description' => 'If specified, defines "recent", in number of seconds, for "Download recently allocated DIDs" in self-service.',
3123     'type'        => 'text',
3124   },
3125
3126   {
3127     'key'         => 'selfservice_server-view-wholesale',
3128     'section'     => 'self-service',
3129     'description' => 'If enabled, use a wholesale package view in the self-service.',
3130     'type'        => 'checkbox',
3131   },
3132   
3133   {
3134     'key'         => 'selfservice-agent_signup',
3135     'section'     => 'self-service',
3136     'description' => 'Allow agent signup via self-service.',
3137     'type'        => 'checkbox',
3138   },
3139
3140   {
3141     'key'         => 'selfservice-agent_signup-agent_type',
3142     'section'     => 'self-service',
3143     'description' => 'Agent type when allowing agent signup via self-service.',
3144     'type'        => 'select-sub',
3145     'options_sub' => sub { require FS::Record;
3146                            require FS::agent_type;
3147                            map { $_->typenum => $_->atype }
3148                                FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
3149                          },
3150     'option_sub'  => sub { require FS::Record;
3151                            require FS::agent_type;
3152                            my $agent_type = FS::Record::qsearchs(
3153                              'agent_type', { 'typenum'=>shift }
3154                            );
3155                            $agent_type ? $agent_type->atype : '';
3156                          },
3157   },
3158
3159   {
3160     'key'         => 'selfservice-agent_login',
3161     'section'     => 'self-service',
3162     'description' => 'Allow agent login via self-service.',
3163     'type'        => 'checkbox',
3164   },
3165
3166   {
3167     'key'         => 'selfservice-self_suspend_reason',
3168     'section'     => 'self-service',
3169     'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.',
3170     'type'        => 'select-sub',
3171     #false laziness w/api_credit_reason
3172     'options_sub' => sub { require FS::Record;
3173                            require FS::reason;
3174                            my $type = qsearchs('reason_type', 
3175                              { class => 'S' }) 
3176                               or return ();
3177                            map { $_->reasonnum => $_->reason }
3178                                FS::Record::qsearch('reason', 
3179                                  { reason_type => $type->typenum } 
3180                                );
3181                          },
3182     'option_sub'  => sub { require FS::Record;
3183                            require FS::reason;
3184                            my $reason = FS::Record::qsearchs(
3185                              'reason', { 'reasonnum' => shift }
3186                            );
3187                            $reason ? $reason->reason : '';
3188                          },
3189
3190     'per_agent'   => 1,
3191   },
3192
3193   {
3194     'key'         => 'card_refund-days',
3195     'section'     => 'billing',
3196     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',
3197     'type'        => 'text',
3198   },
3199
3200   {
3201     'key'         => 'agent-showpasswords',
3202     'section'     => '',
3203     'description' => 'Display unencrypted user passwords in the agent (reseller) interface',
3204     'type'        => 'checkbox',
3205   },
3206
3207   {
3208     'key'         => 'global_unique-username',
3209     'section'     => 'username',
3210     '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.',
3211     'type'        => 'select',
3212     'select_enum' => [ 'none', 'username', 'username@domain', 'disabled' ],
3213   },
3214
3215   {
3216     'key'         => 'global_unique-phonenum',
3217     'section'     => '',
3218     '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.',
3219     'type'        => 'select',
3220     'select_enum' => [ 'none', 'countrycode+phonenum', 'disabled' ],
3221   },
3222
3223   {
3224     'key'         => 'global_unique-pbx_title',
3225     'section'     => '',
3226     'description' => 'Global phone number 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'         => 'global_unique-pbx_id',
3233     'section'     => '',
3234     'description' => 'Global PBX id uniqueness control: none (check uniqueness per exports), enabled (check across all services), or disabled (no duplicate checking).',
3235     'type'        => 'select',
3236     'select_enum' => [ 'enabled', 'disabled' ],
3237   },
3238
3239   {
3240     'key'         => 'svc_external-skip_manual',
3241     'section'     => 'UI',
3242     '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).',
3243     'type'        => 'checkbox',
3244   },
3245
3246   {
3247     'key'         => 'svc_external-display_type',
3248     'section'     => 'UI',
3249     'description' => 'Select a specific svc_external type to enable some UI changes specific to that type (i.e. artera_turbo).',
3250     'type'        => 'select',
3251     'select_enum' => [ 'generic', 'artera_turbo', ],
3252   },
3253
3254   {
3255     'key'         => 'ticket_system',
3256     'section'     => 'ticketing',
3257     '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).',
3258     'type'        => 'select',
3259     #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ],
3260     'select_enum' => [ '', qw(RT_Internal RT_External) ],
3261   },
3262
3263   {
3264     'key'         => 'network_monitoring_system',
3265     'section'     => 'network_monitoring',
3266     '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>).',
3267     'type'        => 'select',
3268     'select_enum' => [ '', qw(Torrus_Internal) ],
3269   },
3270
3271   {
3272     'key'         => 'nms-auto_add-svc_ips',
3273     'section'     => 'network_monitoring',
3274     'description' => 'Automatically add (and remove) IP addresses from these service tables to the network monitoring system.',
3275     'type'        => 'selectmultiple',
3276     'select_enum' => [ 'svc_acct', 'svc_broadband', 'svc_dsl' ],
3277   },
3278
3279   {
3280     'key'         => 'nms-auto_add-community',
3281     'section'     => 'network_monitoring',
3282     'description' => 'SNMP community string to use when automatically adding IP addresses from these services to the network monitoring system.',
3283     'type'        => 'text',
3284   },
3285
3286   {
3287     'key'         => 'ticket_system-default_queueid',
3288     'section'     => 'ticketing',
3289     'description' => 'Default queue used when creating new customer tickets.',
3290     'type'        => 'select-sub',
3291     'options_sub' => sub {
3292                            my $conf = new FS::Conf;
3293                            if ( $conf->config('ticket_system') ) {
3294                              eval "use FS::TicketSystem;";
3295                              die $@ if $@;
3296                              FS::TicketSystem->queues();
3297                            } else {
3298                              ();
3299                            }
3300                          },
3301     'option_sub'  => sub { 
3302                            my $conf = new FS::Conf;
3303                            if ( $conf->config('ticket_system') ) {
3304                              eval "use FS::TicketSystem;";
3305                              die $@ if $@;
3306                              FS::TicketSystem->queue(shift);
3307                            } else {
3308                              '';
3309                            }
3310                          },
3311   },
3312
3313   {
3314     'key'         => 'ticket_system-force_default_queueid',
3315     'section'     => 'ticketing',
3316     'description' => 'Disallow queue selection when creating new tickets from customer view.',
3317     'type'        => 'checkbox',
3318   },
3319
3320   {
3321     'key'         => 'ticket_system-selfservice_queueid',
3322     'section'     => 'ticketing',
3323     'description' => 'Queue used when creating new customer tickets from self-service.  Defautls to ticket_system-default_queueid if not specified.',
3324     #false laziness w/above
3325     'type'        => 'select-sub',
3326     'options_sub' => sub {
3327                            my $conf = new FS::Conf;
3328                            if ( $conf->config('ticket_system') ) {
3329                              eval "use FS::TicketSystem;";
3330                              die $@ if $@;
3331                              FS::TicketSystem->queues();
3332                            } else {
3333                              ();
3334                            }
3335                          },
3336     'option_sub'  => sub { 
3337                            my $conf = new FS::Conf;
3338                            if ( $conf->config('ticket_system') ) {
3339                              eval "use FS::TicketSystem;";
3340                              die $@ if $@;
3341                              FS::TicketSystem->queue(shift);
3342                            } else {
3343                              '';
3344                            }
3345                          },
3346   },
3347
3348   {
3349     'key'         => 'ticket_system-requestor',
3350     'section'     => 'ticketing',
3351     'description' => 'Email address to use as the requestor for new tickets.  If blank, the customer\'s invoicing address(es) will be used.',
3352     'type'        => 'text',
3353   },
3354
3355   {
3356     'key'         => 'ticket_system-priority_reverse',
3357     'section'     => 'ticketing',
3358     '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.',
3359     'type'        => 'checkbox',
3360   },
3361
3362   {
3363     'key'         => 'ticket_system-custom_priority_field',
3364     'section'     => 'ticketing',
3365     'description' => 'Custom field from the ticketing system to use as a custom priority classification.',
3366     'type'        => 'text',
3367   },
3368
3369   {
3370     'key'         => 'ticket_system-custom_priority_field-values',
3371     'section'     => 'ticketing',
3372     'description' => 'Values for the custom field from the ticketing system to break down and sort customer ticket lists.',
3373     'type'        => 'textarea',
3374   },
3375
3376   {
3377     'key'         => 'ticket_system-custom_priority_field_queue',
3378     'section'     => 'ticketing',
3379     'description' => 'Ticketing system queue in which the custom field specified in ticket_system-custom_priority_field is located.',
3380     'type'        => 'text',
3381   },
3382
3383   {
3384     'key'         => 'ticket_system-selfservice_priority_field',
3385     'section'     => 'ticketing',
3386     'description' => 'Custom field from the ticket system to use as a customer-managed priority field.',
3387     'type'        => 'text',
3388   },
3389
3390   {
3391     'key'         => 'ticket_system-selfservice_edit_subject',
3392     'section'     => 'ticketing',
3393     'description' => 'Allow customers to edit ticket subjects through selfservice.',
3394     'type'        => 'checkbox',
3395   },
3396
3397   {
3398     'key'         => 'ticket_system-appointment-queueid',
3399     'section'     => 'ticketing',
3400     'description' => 'Ticketing queue to use for appointments.',
3401     #false laziness w/above
3402     'type'        => 'select-sub',
3403     'options_sub' => sub {
3404                            my $conf = new FS::Conf;
3405                            if ( $conf->config('ticket_system') ) {
3406                              eval "use FS::TicketSystem;";
3407                              die $@ if $@;
3408                              FS::TicketSystem->queues();
3409                            } else {
3410                              ();
3411                            }
3412                          },
3413     'option_sub'  => sub { 
3414                            my $conf = new FS::Conf;
3415                            if ( $conf->config('ticket_system') ) {
3416                              eval "use FS::TicketSystem;";
3417                              die $@ if $@;
3418                              FS::TicketSystem->queue(shift);
3419                            } else {
3420                              '';
3421                            }
3422                          },
3423   },
3424
3425   {
3426     'key'         => 'ticket_system-appointment-custom_field',
3427     'section'     => 'ticketing',
3428     'description' => 'Ticketing custom field to use as an appointment classification.',
3429     'type'        => 'text',
3430   },
3431
3432   {
3433     'key'         => 'ticket_system-escalation',
3434     'section'     => 'ticketing',
3435     'description' => 'Enable priority escalation of tickets as part of daily batch processing.',
3436     'type'        => 'checkbox',
3437   },
3438
3439   {
3440     'key'         => 'ticket_system-rt_external_datasrc',
3441     'section'     => 'ticketing',
3442     '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>',
3443     'type'        => 'text',
3444
3445   },
3446
3447   {
3448     'key'         => 'ticket_system-rt_external_url',
3449     'section'     => 'ticketing',
3450     'description' => 'With external RT integration, the URL for the external RT installation, for example, <code>https://rt.example.com/rt</code>',
3451     'type'        => 'text',
3452   },
3453
3454   {
3455     'key'         => 'company_name',
3456     'section'     => 'required',
3457     'description' => 'Your company name',
3458     'type'        => 'text',
3459     'per_agent'   => 1, #XXX just FS/FS/ClientAPI/Signup.pm
3460   },
3461
3462   {
3463     'key'         => 'company_url',
3464     'section'     => 'UI',
3465     'description' => 'Your company URL',
3466     'type'        => 'text',
3467     'per_agent'   => 1,
3468   },
3469
3470   {
3471     'key'         => 'company_address',
3472     'section'     => 'required',
3473     'description' => 'Your company address',
3474     'type'        => 'textarea',
3475     'per_agent'   => 1,
3476   },
3477
3478   {
3479     'key'         => 'company_phonenum',
3480     'section'     => 'notification',
3481     'description' => 'Your company phone number',
3482     'type'        => 'text',
3483     'per_agent'   => 1,
3484   },
3485
3486   {
3487     'key'         => 'echeck-void',
3488     'section'     => 'deprecated',
3489     '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',
3490     'type'        => 'checkbox',
3491   },
3492
3493   {
3494     'key'         => 'cc-void',
3495     'section'     => 'deprecated',
3496     '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',
3497     'type'        => 'checkbox',
3498   },
3499
3500   {
3501     'key'         => 'unvoid',
3502     'section'     => 'deprecated',
3503     'description' => '<B>DEPRECATED</B>, now controlled by ACLs.  Used to enable unvoiding of voided payments',
3504     'type'        => 'checkbox',
3505   },
3506
3507   {
3508     'key'         => 'address1-search',
3509     'section'     => 'UI',
3510     '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.',
3511     'type'        => 'checkbox',
3512   },
3513
3514   {
3515     'key'         => 'address2-search',
3516     'section'     => 'UI',
3517     'description' => 'Enable a "Unit" search box which searches the second address field.  Useful for multi-tenant applications.  See also: cust_main-require_address2',
3518     'type'        => 'checkbox',
3519   },
3520
3521   {
3522     'key'         => 'cust_main-require_address2',
3523     'section'     => 'UI',
3524     '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)
3525     'type'        => 'checkbox',
3526   },
3527
3528   {
3529     'key'         => 'agent-ship_address',
3530     'section'     => '',
3531     '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.",
3532     'type'        => 'checkbox',
3533     'per_agent'   => 1,
3534   },
3535
3536   { 'key'         => 'referral_credit',
3537     'section'     => 'deprecated',
3538     '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.",
3539     'type'        => 'checkbox',
3540   },
3541
3542   { 'key'         => 'selfservice_server-cache_module',
3543     'section'     => 'self-service',
3544     '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.',
3545     'type'        => 'select',
3546     'select_enum' => [ 'Cache::SharedMemoryCache', 'Cache::FileCache', ], # '_Database' ],
3547   },
3548
3549   {
3550     'key'         => 'hylafax',
3551     'section'     => 'billing',
3552     '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).',
3553     'type'        => [qw( checkbox textarea )],
3554   },
3555
3556   {
3557     'key'         => 'cust_bill-ftpformat',
3558     'section'     => 'invoicing',
3559     'description' => 'Enable FTP of raw invoice data - format.',
3560     'type'        => 'select',
3561     'options'     => [ spool_formats() ],
3562   },
3563
3564   {
3565     'key'         => 'cust_bill-ftpserver',
3566     'section'     => 'invoicing',
3567     'description' => 'Enable FTP of raw invoice data - server.',
3568     'type'        => 'text',
3569   },
3570
3571   {
3572     'key'         => 'cust_bill-ftpusername',
3573     'section'     => 'invoicing',
3574     'description' => 'Enable FTP of raw invoice data - server.',
3575     'type'        => 'text',
3576   },
3577
3578   {
3579     'key'         => 'cust_bill-ftppassword',
3580     'section'     => 'invoicing',
3581     'description' => 'Enable FTP of raw invoice data - server.',
3582     'type'        => 'text',
3583   },
3584
3585   {
3586     'key'         => 'cust_bill-ftpdir',
3587     'section'     => 'invoicing',
3588     'description' => 'Enable FTP of raw invoice data - server.',
3589     'type'        => 'text',
3590   },
3591
3592   {
3593     'key'         => 'cust_bill-spoolformat',
3594     'section'     => 'invoicing',
3595     'description' => 'Enable spooling of raw invoice data - format.',
3596     'type'        => 'select',
3597     'options'     => [ spool_formats() ],
3598   },
3599
3600   {
3601     'key'         => 'cust_bill-spoolagent',
3602     'section'     => 'invoicing',
3603     'description' => 'Enable per-agent spooling of raw invoice data.',
3604     'type'        => 'checkbox',
3605   },
3606
3607   {
3608     'key'         => 'bridgestone-batch_counter',
3609     'section'     => '',
3610     'description' => 'Batch counter for spool files.  Increments every time a spool file is uploaded.',
3611     'type'        => 'text',
3612     'per_agent'   => 1,
3613   },
3614
3615   {
3616     'key'         => 'bridgestone-prefix',
3617     'section'     => '',
3618     'description' => 'Agent identifier for uploading to BABT printing service.',
3619     'type'        => 'text',
3620     'per_agent'   => 1,
3621   },
3622
3623   {
3624     'key'         => 'bridgestone-confirm_template',
3625     'section'     => '',
3626     '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.',
3627     # this could use a true message template, but it's hard to see how that
3628     # would make the world a better place
3629     'type'        => 'textarea',
3630     'per_agent'   => 1,
3631   },
3632
3633   {
3634     'key'         => 'ics-confirm_template',
3635     'section'     => '',
3636     'description' => 'Confirmation email template for uploading to ICS invoice printing.  Text::Template format, with variables "%count" and "%sum".',
3637     'type'        => 'textarea',
3638     'per_agent'   => 1,
3639   },
3640
3641   {
3642     'key'         => 'svc_acct-usage_suspend',
3643     'section'     => 'billing',
3644     '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.',
3645     'type'        => 'checkbox',
3646   },
3647
3648   {
3649     'key'         => 'svc_acct-usage_unsuspend',
3650     'section'     => 'billing',
3651     '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.',
3652     'type'        => 'checkbox',
3653   },
3654
3655   {
3656     'key'         => 'svc_acct-usage_threshold',
3657     'section'     => 'billing',
3658     '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.',
3659     'type'        => 'text',
3660   },
3661
3662   {
3663     'key'         => 'overlimit_groups',
3664     'section'     => '',
3665     'description' => 'RADIUS group(s) to assign to svc_acct which has exceeded its bandwidth or time limit.',
3666     'type'        => 'select-sub',
3667     'per_agent'   => 1,
3668     'multiple'    => 1,
3669     'options_sub' => sub { require FS::Record;
3670                            require FS::radius_group;
3671                            map { $_->groupnum => $_->long_description }
3672                                FS::Record::qsearch('radius_group', {} );
3673                          },
3674     'option_sub'  => sub { require FS::Record;
3675                            require FS::radius_group;
3676                            my $radius_group = FS::Record::qsearchs(
3677                              'radius_group', { 'groupnum' => shift }
3678                            );
3679                $radius_group ? $radius_group->long_description : '';
3680                          },
3681   },
3682
3683   {
3684     'key'         => 'cust-fields',
3685     'section'     => 'UI',
3686     'description' => 'Which customer fields to display on reports by default',
3687     'type'        => 'select',
3688     'select_hash' => [ FS::ConfDefaults->cust_fields_avail() ],
3689   },
3690
3691   {
3692     'key'         => 'cust_location-label_prefix',
3693     'section'     => 'UI',
3694     'description' => 'Optional "site ID" to show in the location label',
3695     'type'        => 'select',
3696     'select_hash' => [ '' => '',
3697                        'CoStAg'    => 'CoStAgXXXXX (country, state, agent name, locationnum)',
3698                        '_location' => 'Manually defined per location',
3699                       ],
3700   },
3701
3702   {
3703     'key'         => 'cust_pkg-display_times',
3704     'section'     => 'UI',
3705     'description' => 'Display full timestamps (not just dates) for customer packages.  Useful if you are doing real-time things like hourly prepaid.',
3706     'type'        => 'checkbox',
3707   },
3708
3709   {
3710     'key'         => 'cust_pkg-always_show_location',
3711     'section'     => 'UI',
3712     'description' => "Always display package locations, even when they're all the default service address.",
3713     'type'        => 'checkbox',
3714   },
3715
3716   {
3717     'key'         => 'cust_pkg-group_by_location',
3718     'section'     => 'UI',
3719     'description' => "Group packages by location.",
3720     'type'        => 'checkbox',
3721   },
3722
3723   {
3724     'key'         => 'cust_pkg-large_pkg_size',
3725     'section'     => 'UI',
3726     'description' => "In customer view, summarize packages with more than this many services.  Set to zero to never summarize packages.",
3727     'type'        => 'text',
3728   },
3729
3730   {
3731     'key'         => 'cust_pkg-hide_discontinued-part_svc',
3732     'section'     => 'UI',
3733     '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.",
3734     'type'        => 'checkbox',
3735   },
3736
3737   {
3738     'key'         => 'part_pkg-show_fcc_options',
3739     'section'     => 'UI',
3740     'description' => "Show fields on package definitions for FCC Form 477 classification",
3741     'type'        => 'checkbox',
3742   },
3743
3744   {
3745     'key'         => 'svc_acct-edit_uid',
3746     'section'     => 'shell',
3747     'description' => 'Allow UID editing.',
3748     'type'        => 'checkbox',
3749   },
3750
3751   {
3752     'key'         => 'svc_acct-edit_gid',
3753     'section'     => 'shell',
3754     'description' => 'Allow GID editing.',
3755     'type'        => 'checkbox',
3756   },
3757
3758   {
3759     'key'         => 'svc_acct-no_edit_username',
3760     'section'     => 'shell',
3761     'description' => 'Disallow username editing.',
3762     'type'        => 'checkbox',
3763   },
3764
3765   {
3766     'key'         => 'zone-underscore',
3767     'section'     => 'BIND',
3768     'description' => 'Allow underscores in zone names.  As underscores are illegal characters in zone names, this option is not recommended.',
3769     'type'        => 'checkbox',
3770   },
3771
3772   {
3773     'key'         => 'echeck-nonus',
3774     'section'     => 'deprecated',
3775     'description' => 'Deprecated; see echeck-country instead.  Used to disable ABA-format account checking for Electronic Check payment info',
3776     'type'        => 'checkbox',
3777   },
3778
3779   {
3780     'key'         => 'echeck-country',
3781     'section'     => 'billing',
3782     'description' => 'Format electronic check information for the specified country.',
3783     'type'        => 'select',
3784     'select_hash' => [ 'US' => 'United States',
3785                        'CA' => 'Canada (enables branch)',
3786                        'XX' => 'Other',
3787                      ],
3788   },
3789
3790   {
3791     'key'         => 'voip-cust_accountcode_cdr',
3792     'section'     => 'telephony',
3793     'description' => 'Enable the per-customer option for CDR breakdown by accountcode.',
3794     'type'        => 'checkbox',
3795   },
3796
3797   {
3798     'key'         => 'voip-cust_cdr_spools',
3799     'section'     => 'telephony',
3800     'description' => 'Enable the per-customer option for individual CDR spools.',
3801     'type'        => 'checkbox',
3802   },
3803
3804   {
3805     'key'         => 'voip-cust_cdr_squelch',
3806     'section'     => 'telephony',
3807     'description' => 'Enable the per-customer option for not printing CDR on invoices.',
3808     'type'        => 'checkbox',
3809   },
3810
3811   {
3812     'key'         => 'voip-cdr_email',
3813     'section'     => 'telephony',
3814     '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.',
3815     'type'        => 'checkbox',
3816   },
3817
3818   {
3819     'key'         => 'voip-cust_email_csv_cdr',
3820     'section'     => 'deprecated',
3821     '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.',
3822     'type'        => 'checkbox',
3823   },
3824
3825   {
3826     'key'         => 'voip-cdr_email_attach',
3827     'section'     => 'telephony',
3828     'description' => 'Enable the per-customer option for including CDR information as an attachment on emailed invoices.',
3829     'type'        => 'select',
3830     'select_hash' => [ ''    => 'Disabled',
3831                        'csv' => 'Text (CSV) attachment',
3832                        'zip' => 'Zip attachment',
3833                      ],
3834   },
3835
3836   {
3837     'key'         => 'cgp_rule-domain_templates',
3838     'section'     => '',
3839     'description' => 'Communigate Pro rule templates for domains, one per line, "svcnum Name"',
3840     'type'        => 'textarea',
3841   },
3842
3843   {
3844     'key'         => 'svc_forward-no_srcsvc',
3845     'section'     => '',
3846     '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.",
3847     'type'        => 'checkbox',
3848   },
3849
3850   {
3851     'key'         => 'svc_forward-arbitrary_dst',
3852     'section'     => '',
3853     '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.",
3854     'type'        => 'checkbox',
3855   },
3856
3857   {
3858     'key'         => 'tax-ship_address',
3859     'section'     => 'billing',
3860     'description' => 'By default, tax calculations are done based on the billing address.  Enable this switch to calculate tax based on the shipping address instead.',
3861     'type'        => 'checkbox',
3862   }
3863 ,
3864   {
3865     'key'         => 'tax-pkg_address',
3866     'section'     => 'billing',
3867     '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).',
3868     'type'        => 'checkbox',
3869   },
3870
3871   {
3872     'key'         => 'invoice-ship_address',
3873     'section'     => 'invoicing',
3874     'description' => 'Include the shipping address on invoices.',
3875     'type'        => 'checkbox',
3876   },
3877
3878   {
3879     'key'         => 'invoice-all_pkg_addresses',
3880     'section'     => 'invoicing',
3881     'description' => 'Show all package addresses on invoices, even the default.',
3882     'type'        => 'checkbox',
3883   },
3884
3885   {
3886     'key'         => 'invoice-unitprice',
3887     'section'     => 'invoicing',
3888     'description' => 'Enable unit pricing on invoices and quantities on packages.',
3889     'type'        => 'checkbox',
3890   },
3891
3892   {
3893     'key'         => 'invoice-smallernotes',
3894     'section'     => 'invoicing',
3895     'description' => 'Display the notes section in a smaller font on invoices.',
3896     'type'        => 'checkbox',
3897   },
3898
3899   {
3900     'key'         => 'invoice-smallerfooter',
3901     'section'     => 'invoicing',
3902     'description' => 'Display footers in a smaller font on invoices.',
3903     'type'        => 'checkbox',
3904   },
3905
3906   {
3907     'key'         => 'postal_invoice-fee_pkgpart',
3908     'section'     => 'billing',
3909     'description' => 'This allows selection of a package to insert on invoices for customers with postal invoices selected.',
3910     'type'        => 'select-part_pkg',
3911     'per_agent'   => 1,
3912   },
3913
3914   {
3915     'key'         => 'postal_invoice-recurring_only',
3916     'section'     => 'billing',
3917     'description' => 'The postal invoice fee is omitted on invoices without recurring charges when this is set.',
3918     'type'        => 'checkbox',
3919   },
3920
3921   {
3922     'key'         => 'batch-enable',
3923     'section'     => 'deprecated', #make sure batch-enable_payby is set for
3924                                    #everyone before removing
3925     'description' => 'Enable credit card and/or ACH batching - leave disabled for real-time installations.',
3926     'type'        => 'checkbox',
3927   },
3928
3929   {
3930     'key'         => 'batch-enable_payby',
3931     'section'     => 'billing',
3932     'description' => 'Enable batch processing for the specified payment types.',
3933     'type'        => 'selectmultiple',
3934     'select_enum' => [qw( CARD CHEK )],
3935   },
3936
3937   {
3938     'key'         => 'realtime-disable_payby',
3939     'section'     => 'billing',
3940     'description' => 'Disable realtime processing for the specified payment types.',
3941     'type'        => 'selectmultiple',
3942     'select_enum' => [qw( CARD CHEK )],
3943   },
3944
3945   {
3946     'key'         => 'batch-default_format',
3947     'section'     => 'billing',
3948     'description' => 'Default format for batches.',
3949     'type'        => 'select',
3950     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch',
3951                        'csv-chase_canada-E-xactBatch', 'BoM', 'PAP',
3952                        'paymentech', 'ach-spiritone', 'RBC', 'CIBC',
3953                     ]
3954   },
3955
3956   { 'key'         => 'batch-gateway-CARD',
3957     'section'     => 'billing',
3958     'description' => 'Business::BatchPayment gateway for credit card batches.',
3959     %batch_gateway_options,
3960   },
3961
3962   { 'key'         => 'batch-gateway-CHEK',
3963     'section'     => 'billing', 
3964     'description' => 'Business::BatchPayment gateway for check batches.',
3965     %batch_gateway_options,
3966   },
3967
3968   {
3969     'key'         => 'batch-reconsider',
3970     'section'     => 'billing',
3971     '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.',
3972     'type'        => 'checkbox',
3973   },
3974
3975   {
3976     'key'         => 'batch-auto_resolve_days',
3977     'section'     => 'billing',
3978     'description' => 'Automatically resolve payment batches this many days after they were first downloaded.',
3979     'type'        => 'text',
3980   },
3981
3982   {
3983     'key'         => 'batch-auto_resolve_status',
3984     'section'     => 'billing',
3985     'description' => 'When automatically resolving payment batches, take this action for payments of unknown status.',
3986     'type'        => 'select',
3987     'select_enum' => [ 'approve', 'decline' ],
3988   },
3989
3990   {
3991     'key'         => 'batch-errors_to',
3992     'section'     => 'billing',
3993     'description' => 'Email errors when processing batches to this address.  If unspecified, batch processing will stop immediately on error.',
3994     'type'        => 'text',
3995   },
3996
3997   #lists could be auto-generated from pay_batch info
3998   {
3999     'key'         => 'batch-fixed_format-CARD',
4000     'section'     => 'billing',
4001     'description' => 'Fixed (unchangeable) format for credit card batches.',
4002     'type'        => 'select',
4003     'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ,
4004                        'csv-chase_canada-E-xactBatch', 'paymentech' ]
4005   },
4006
4007   {
4008     'key'         => 'batch-fixed_format-CHEK',
4009     'section'     => 'billing',
4010     'description' => 'Fixed (unchangeable) format for electronic check batches.',
4011     'type'        => 'select',
4012     'select_enum' => [ 'NACHA', 'csv-td_canada_trust-merchant_pc_batch', 'BoM',
4013                        'PAP', 'paymentech', 'ach-spiritone', 'RBC',
4014                        'td_eft1464', 'eft_canada', 'CIBC'
4015                      ]
4016   },
4017
4018   {
4019     'key'         => 'batch-increment_expiration',
4020     'section'     => 'billing',
4021     'description' => 'Increment expiration date years in batches until cards are current.  Make sure this is acceptable to your batching provider before enabling.',
4022     'type'        => 'checkbox'
4023   },
4024
4025   {
4026     'key'         => 'batchconfig-BoM',
4027     'section'     => 'billing',
4028     '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',
4029     'type'        => 'textarea',
4030   },
4031
4032 {
4033     'key'         => 'batchconfig-CIBC',
4034     'section'     => 'billing',
4035     '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',
4036     'type'        => 'textarea',
4037   },
4038
4039   {
4040     'key'         => 'batchconfig-PAP',
4041     'section'     => 'billing',
4042     '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',
4043     'type'        => 'textarea',
4044   },
4045
4046   {
4047     'key'         => 'batchconfig-csv-chase_canada-E-xactBatch',
4048     'section'     => 'billing',
4049     'description' => 'Gateway ID for Chase Canada E-xact batching',
4050     'type'        => 'text',
4051   },
4052
4053   {
4054     'key'         => 'batchconfig-paymentech',
4055     'section'     => 'billing',
4056     '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.',
4057     'type'        => 'textarea',
4058   },
4059
4060   {
4061     'key'         => 'batchconfig-RBC',
4062     'section'     => 'billing',
4063     '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.',
4064     'type'        => 'textarea',
4065   },
4066
4067   {
4068     'key'         => 'batchconfig-RBC-login',
4069     'section'     => 'billing',
4070     '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.',
4071     'type'        => 'textarea',
4072   },
4073
4074   {
4075     'key'         => 'batchconfig-td_eft1464',
4076     'section'     => 'billing',
4077     '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.',
4078     'type'        => 'textarea',
4079   },
4080
4081   {
4082     'key'         => 'batchconfig-eft_canada',
4083     'section'     => 'billing',
4084     '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.',
4085     'type'        => 'textarea',
4086     'per_agent'   => 1,
4087   },
4088
4089   {
4090     'key'         => 'batchconfig-nacha-destination',
4091     'section'     => 'billing',
4092     'description' => 'Configuration for NACHA batching, Destination (9 digit transit routing number).',
4093     'type'        => 'text',
4094   },
4095
4096   {
4097     'key'         => 'batchconfig-nacha-destination_name',
4098     'section'     => 'billing',
4099     'description' => 'Configuration for NACHA batching, Destination (Bank Name, up to 23 characters).',
4100     'type'        => 'text',
4101   },
4102
4103   {
4104     'key'         => 'batchconfig-nacha-origin',
4105     'section'     => 'billing',
4106     'description' => 'Configuration for NACHA batching, Origin (your 10-digit company number, IRS tax ID recommended).',
4107     'type'        => 'text',
4108   },
4109
4110   {
4111     'key'         => 'batchconfig-nacha-origin_name',
4112     'section'     => 'billing',
4113     'description' => 'Configuration for NACHA batching, Origin name (defaults to company name, but sometimes bank name is needed instead.)',
4114     'type'        => 'text',
4115   },
4116
4117   {
4118     'key'         => 'batch-manual_approval',
4119     'section'     => 'billing',
4120     '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.',
4121     'type'        => 'checkbox',
4122   },
4123
4124   {
4125     'key'         => 'batch-spoolagent',
4126     'section'     => 'billing',
4127     'description' => 'Store payment batches per-agent.',
4128     'type'        => 'checkbox',
4129   },
4130
4131   {
4132     'key'         => 'payment_history-years',
4133     'section'     => 'UI',
4134     'description' => 'Number of years of payment history to show by default.  Currently defaults to 2.',
4135     'type'        => 'text',
4136   },
4137
4138   {
4139     'key'         => 'change_history-years',
4140     'section'     => 'UI',
4141     'description' => 'Number of years of change history to show by default.  Currently defaults to 0.5.',
4142     'type'        => 'text',
4143   },
4144
4145   {
4146     'key'         => 'cust_main-packages-years',
4147     'section'     => 'UI',
4148     'description' => 'Number of years to show old (cancelled and one-time charge) packages by default.  Currently defaults to 2.',
4149     'type'        => 'text',
4150   },
4151
4152   {
4153     'key'         => 'cust_main-use_comments',
4154     'section'     => 'UI',
4155     'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
4156     'type'        => 'checkbox',
4157   },
4158
4159   {
4160     'key'         => 'cust_main-disable_notes',
4161     'section'     => 'UI',
4162     'description' => 'Disable new style customer notes - timestamped and user identified customer notes.  Useful in tracking who did what.',
4163     'type'        => 'checkbox',
4164   },
4165
4166   {
4167     'key'         => 'cust_main_note-display_times',
4168     'section'     => 'UI',
4169     'description' => 'Display full timestamps (not just dates) for customer notes.',
4170     'type'        => 'checkbox',
4171   },
4172
4173   {
4174     'key'         => 'cust_main-ticket_statuses',
4175     'section'     => 'UI',
4176     'description' => 'Show tickets with these statuses on the customer view page.',
4177     'type'        => 'selectmultiple',
4178     'select_enum' => [qw( new open stalled resolved rejected deleted )],
4179   },
4180
4181   {
4182     'key'         => 'cust_main-max_tickets',
4183     'section'     => 'UI',
4184     'description' => 'Maximum number of tickets to show on the customer view page.',
4185     'type'        => 'text',
4186   },
4187
4188   {
4189     'key'         => 'cust_main-enable_birthdate',
4190     'section'     => 'UI',
4191     'description' => 'Enable tracking of a birth date with each customer record',
4192     'type'        => 'checkbox',
4193   },
4194
4195   {
4196     'key'         => 'cust_main-enable_spouse',
4197     'section'     => 'UI',
4198     'description' => 'Enable tracking of a spouse\'s name and date of birth with each customer record',
4199     'type'        => 'checkbox',
4200   },
4201
4202   {
4203     'key'         => 'cust_main-enable_anniversary_date',
4204     'section'     => 'UI',
4205     'description' => 'Enable tracking of an anniversary date with each customer record',
4206     'type'        => 'checkbox',
4207   },
4208
4209   {
4210     'key'         => 'cust_main-enable_order_package',
4211     'section'     => 'UI',
4212     'description' => 'Display order new package on the basic tab',
4213     'type'        => 'checkbox',
4214   },
4215
4216   {
4217     'key'         => 'cust_main-edit_calling_list_exempt',
4218     'section'     => 'UI',
4219     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
4220     'type'        => 'checkbox',
4221   },
4222
4223   {
4224     'key'         => 'support-key',
4225     'section'     => '',
4226     'description' => 'A support key enables access to commercial services delivered over the network, such as address normalization and invoice printing.',
4227     'type'        => 'text',
4228   },
4229
4230   {
4231     'key'         => 'freesideinc-webservice-svcpart',
4232     'section'     => '',
4233     'description' => 'Do not set this.',
4234     'type'        => 'text',
4235   },
4236
4237   {
4238     'key'         => 'card-types',
4239     'section'     => 'billing',
4240     'description' => 'Select one or more card types to enable only those card types.  If no card types are selected, all card types are available.',
4241     'type'        => 'selectmultiple',
4242     'select_enum' => \@card_types,
4243   },
4244
4245   {
4246     'key'         => 'disable-fuzzy',
4247     'section'     => 'UI',
4248     'description' => 'Disable fuzzy searching.  Speeds up searching for large sites, but only shows exact matches.',
4249     'type'        => 'checkbox',
4250   },
4251
4252   {
4253     'key'         => 'fuzzy-fuzziness',
4254     'section'     => 'UI',
4255     'description' => 'Set the "fuzziness" of fuzzy searching (see the String::Approx manpage for details).  Defaults to 10%',
4256     'type'        => 'text',
4257   },
4258
4259   {
4260     'key'         => 'enable_fuzzy_on_exact',
4261     'section'     => 'UI',
4262     'description' => 'Enable approximate customer searching even when an exact match is found.',
4263     'type'        => 'checkbox',
4264   },
4265
4266   { 'key'         => 'pkg_referral',
4267     'section'     => '',
4268     'description' => 'Enable package-specific advertising sources.',
4269     'type'        => 'checkbox',
4270   },
4271
4272   { 'key'         => 'pkg_referral-multiple',
4273     'section'     => '',
4274     'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
4275     'type'        => 'checkbox',
4276   },
4277
4278   {
4279     'key'         => 'dashboard-install_welcome',
4280     'section'     => 'UI',
4281     'description' => 'New install welcome screen.',
4282     'type'        => 'select',
4283     'select_enum' => [ '', 'ITSP_fsinc_hosted', ],
4284   },
4285
4286   {
4287     'key'         => 'dashboard-toplist',
4288     'section'     => 'UI',
4289     'description' => 'List of items to display on the top of the front page',
4290     'type'        => 'textarea',
4291   },
4292
4293   {
4294     'key'         => 'impending_recur_msgnum',
4295     'section'     => 'notification',
4296     'description' => 'Template to use for alerts about first-time recurring billing.',
4297     %msg_template_options,
4298   },
4299
4300   {
4301     'key'         => 'impending_recur_template',
4302     'section'     => 'deprecated',
4303     '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>',
4304 # <li><code>$payby</code> <li><code>$expdate</code> most likely only confuse
4305     'type'        => 'textarea',
4306   },
4307
4308   {
4309     'key'         => 'logo.png',
4310     'section'     => 'UI',  #'invoicing' ?
4311     'description' => 'Company logo for HTML invoices and the backoffice interface, in PNG format.  Suggested size somewhere near 92x62.',
4312     'type'        => 'image',
4313     'per_agent'   => 1, #XXX just view/logo.cgi, which is for the global
4314                         #old-style editor anyway...?
4315     'per_locale'  => 1,
4316   },
4317
4318   {
4319     'key'         => 'logo.eps',
4320     'section'     => 'invoicing',
4321     'description' => 'Company logo for printed and PDF invoices, in EPS format.',
4322     'type'        => 'image',
4323     'per_agent'   => 1, #XXX as above, kinda
4324     'per_locale'  => 1,
4325   },
4326
4327   {
4328     'key'         => 'selfservice-ignore_quantity',
4329     'section'     => 'self-service',
4330     'description' => 'Ignores service quantity restrictions in self-service context.  Strongly not recommended - just set your quantities correctly in the first place.',
4331     'type'        => 'checkbox',
4332   },
4333
4334   {
4335     'key'         => 'selfservice-session_timeout',
4336     'section'     => 'self-service',
4337     'description' => 'Self-service session timeout.  Defaults to 1 hour.',
4338     'type'        => 'select',
4339     'select_enum' => [ '1 hour', '2 hours', '4 hours', '8 hours', '1 day', '1 week', ],
4340   },
4341
4342   {
4343     'key'         => 'password-generated-characters',
4344     'section'     => 'password',
4345     'description' => 'Set of characters to use when generating random passwords. This must contain at least one lowercase letter, uppercase letter, digit, and punctuation mark.',
4346     'type'        => 'textarea',
4347   },
4348
4349   {
4350     'key'         => 'password-no_reuse',
4351     'section'     => 'password',
4352     'description' => 'Minimum number of password changes before a password can be reused. By default, passwords can be reused without restriction.',
4353     'type'        => 'text',
4354   },
4355
4356   {
4357     'key'         => 'password-insecure',
4358     'section'     => 'password',
4359     'description' => 'Disable all password security checks and allow entry of insecure passwords.  NOT RECOMMENDED.',
4360     'type'        => 'checkbox',
4361     'per_agent'   => 1,
4362   },
4363
4364   {
4365     'key'         => 'datavolume-forcemegabytes',
4366     'section'     => 'UI',
4367     'description' => 'All data volumes are expressed in megabytes',
4368     'type'        => 'checkbox',
4369   },
4370
4371   {
4372     'key'         => 'datavolume-significantdigits',
4373     'section'     => 'UI',
4374     'description' => 'number of significant digits to use to represent data volumes',
4375     'type'        => 'text',
4376   },
4377
4378   {
4379     'key'         => 'disable_void_after',
4380     'section'     => 'billing',
4381     'description' => 'Number of seconds after which freeside won\'t attempt to VOID a payment first when performing a refund.',
4382     'type'        => 'text',
4383   },
4384
4385   {
4386     'key'         => 'disable_line_item_date_ranges',
4387     'section'     => 'billing',
4388     'description' => 'Prevent freeside from automatically generating date ranges on invoice line items.',
4389     'type'        => 'checkbox',
4390   },
4391
4392   {
4393     'key'         => 'cust_bill-line_item-date_style',
4394     'section'     => 'billing',
4395     'description' => 'Display format for line item date ranges on invoice line items.',
4396     'type'        => 'select',
4397     'select_hash' => [ ''           => 'STARTDATE-ENDDATE',
4398                        'month_of'   => 'Month of MONTHNAME',
4399                        'X_month'    => 'DATE_DESC MONTHNAME',
4400                      ],
4401     'per_agent'   => 1,
4402   },
4403
4404   {
4405     'key'         => 'cust_bill-line_item-date_style-non_monthly',
4406     'section'     => 'billing',
4407     'description' => 'If set, override cust_bill-line_item-date_style for non-monthly charges.',
4408     'type'        => 'select',
4409     'select_hash' => [ ''           => 'Default',
4410                        'start_end'  => 'STARTDATE-ENDDATE',
4411                        'month_of'   => 'Month of MONTHNAME',
4412                        'X_month'    => 'DATE_DESC MONTHNAME',
4413                      ],
4414     'per_agent'   => 1,
4415   },
4416
4417   {
4418     'key'         => 'cust_bill-line_item-date_description',
4419     'section'     => 'billing',
4420     'description' => 'Text to display for "DATE_DESC" when using cust_bill-line_item-date_style DATE_DESC MONTHNAME.',
4421     'type'        => 'text',
4422     'per_agent'   => 1,
4423   },
4424
4425   {
4426     'key'         => 'support_packages',
4427     'section'     => '',
4428     '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...
4429     'type'        => 'select-part_pkg',
4430     'multiple'    => 1,
4431   },
4432
4433   {
4434     'key'         => 'cust_main-require_phone',
4435     'section'     => '',
4436     'description' => 'Require daytime or night phone for all customer records.',
4437     'type'        => 'checkbox',
4438     'per_agent'   => 1,
4439   },
4440
4441   {
4442     'key'         => 'cust_main-require_invoicing_list_email',
4443     'section'     => '',
4444     'description' => 'Email address field is required: require at least one invoicing email address for all customer records.',
4445     'type'        => 'checkbox',
4446     'per_agent'   => 1,
4447   },
4448
4449   {
4450     'key'         => 'cust_main-require_classnum',
4451     'section'     => '',
4452     'description' => 'Customer class is required: require customer class for all customer records.',
4453     'type'        => 'checkbox',
4454   },
4455
4456   {
4457     'key'         => 'cust_main-check_unique',
4458     'section'     => '',
4459     'description' => 'Warn before creating a customer record where these fields duplicate another customer.',
4460     'type'        => 'select',
4461     'multiple'    => 1,
4462     'select_hash' => [ 
4463       'address' => 'Billing or service address',
4464     ],
4465   },
4466
4467   {
4468     'key'         => 'svc_acct-display_paid_time_remaining',
4469     'section'     => '',
4470     'description' => 'Show paid time remaining in addition to time remaining.',
4471     'type'        => 'checkbox',
4472   },
4473
4474   {
4475     'key'         => 'cancel_credit_type',
4476     'section'     => 'billing',
4477     'description' => 'The group to use for new, automatically generated credit reasons resulting from cancellation.',
4478     reason_type_options('R'),
4479   },
4480
4481   {
4482     'key'         => 'suspend_credit_type',
4483     'section'     => 'billing',
4484     'description' => 'The group to use for new, automatically generated credit reasons resulting from package suspension.',
4485     reason_type_options('R'),
4486   },
4487
4488   {
4489     'key'         => 'referral_credit_type',
4490     'section'     => 'deprecated',
4491     '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.',
4492     reason_type_options('R'),
4493   },
4494
4495   # was only used to negate invoices during signup when card was declined, now we just void
4496   {
4497     'key'         => 'signup_credit_type',
4498     'section'     => 'deprecated', #self-service?
4499     'description' => 'The group to use for new, automatically generated credit reasons resulting from signup and self-service declines.',
4500     reason_type_options('R'),
4501   },
4502
4503   {
4504     'key'         => 'prepayment_discounts-credit_type',
4505     'section'     => 'billing',
4506     'description' => 'Enables the offering of prepayment discounts and establishes the credit reason type.',
4507     reason_type_options('R'),
4508   },
4509
4510   {
4511     'key'         => 'cust_main-agent_custid-format',
4512     'section'     => '',
4513     'description' => 'Enables searching of various formatted values in cust_main.agent_custid',
4514     'type'        => 'select',
4515     'select_hash' => [
4516                        ''       => 'Numeric only',
4517                        '\d{7}'  => 'Numeric only, exactly 7 digits',
4518                        'ww?d+'  => 'Numeric with one or two letter prefix',
4519                      ],
4520   },
4521
4522   {
4523     'key'         => 'card_masking_method',
4524     'section'     => 'UI',
4525     '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.',
4526     'type'        => 'select',
4527     'select_hash' => [
4528                        ''            => '123456xxxxxx1234',
4529                        'first6last2' => '123456xxxxxxxx12',
4530                        'first4last4' => '1234xxxxxxxx1234',
4531                        'first4last2' => '1234xxxxxxxxxx12',
4532                        'first2last4' => '12xxxxxxxxxx1234',
4533                        'first2last2' => '12xxxxxxxxxxxx12',
4534                        'first0last4' => 'xxxxxxxxxxxx1234',
4535                        'first0last2' => 'xxxxxxxxxxxxxx12',
4536                      ],
4537   },
4538
4539   {
4540     'key'         => 'disable_previous_balance',
4541     'section'     => 'invoicing',
4542     'description' => 'Show new charges only; do not list previous invoices, payments, or credits on the invoice.',
4543     'type'        => 'checkbox',
4544     'per_agent'   => 1,
4545   },
4546
4547   {
4548     'key'         => 'previous_balance-exclude_from_total',
4549     'section'     => 'invoicing',
4550     'description' => 'Show separate totals for previous invoice balance and new charges. Only meaningful when invoice_sections is false.',
4551     'type'        => 'checkbox',
4552   },
4553
4554   {
4555     'key'         => 'previous_balance-text',
4556     'section'     => 'invoicing',
4557     'description' => 'Text for the label of the total previous balance, when it is shown separately. Defaults to "Previous Balance".',
4558     'type'        => 'text',
4559   },
4560
4561   {
4562     'key'         => 'previous_balance-text-total_new_charges',
4563     'section'     => 'invoicing',
4564     '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".',
4565     'type'        => 'text',
4566   },
4567
4568   {
4569     'key'         => 'previous_balance-section',
4570     'section'     => 'invoicing',
4571     'description' => 'Show previous invoice balances in a separate invoice section.  Does not require invoice_sections to be enabled.',
4572     'type'        => 'checkbox',
4573   },
4574
4575   {
4576     'key'         => 'previous_balance-summary_only',
4577     'section'     => 'invoicing',
4578     'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.',
4579     'type'        => 'checkbox',
4580   },
4581
4582   {
4583     'key'         => 'previous_balance-show_credit',
4584     'section'     => 'invoicing',
4585     'description' => 'Show the customer\'s credit balance on invoices when applicable.',
4586     'type'        => 'checkbox',
4587   },
4588
4589   {
4590     'key'         => 'previous_balance-show_on_statements',
4591     'section'     => 'invoicing',
4592     'description' => 'Show previous invoices on statements, without itemized charges.',
4593     'type'        => 'checkbox',
4594   },
4595
4596   {
4597     'key'         => 'previous_balance-payments_since',
4598     'section'     => 'invoicing',
4599     'description' => 'Instead of showing payments (and credits) applied to the invoice, show those received since the previous invoice date.',
4600     'type'        => 'checkbox',
4601   },
4602
4603   {
4604     'key'         => 'previous_invoice_history',
4605     'section'     => 'invoicing',
4606     'description' => 'Show a month-by-month history of the customer\'s '.
4607                      'billing amounts.  This requires template '.
4608                      'modification and is currently not supported on the '.
4609                      'stock template.',
4610     'type'        => 'checkbox',
4611   },
4612
4613   {
4614     'key'         => 'balance_due_below_line',
4615     'section'     => 'invoicing',
4616     'description' => 'Place the balance due message below a line.  Only meaningful when when invoice_sections is false.',
4617     'type'        => 'checkbox',
4618   },
4619
4620   {
4621     'key'         => 'always_show_tax',
4622     'section'     => 'invoicing',
4623     'description' => 'Show a line for tax on the invoice even when the tax is zero.  Optionally provide text for the tax name to show.',
4624     'type'        => [ qw(checkbox text) ],
4625   },
4626
4627   {
4628     'key'         => 'address_standardize_method',
4629     'section'     => 'UI', #???
4630     'description' => 'Method for standardizing customer addresses.',
4631     'type'        => 'select',
4632     'select_hash' => [ '' => '', 
4633                        'usps'     => 'U.S. Postal Service',
4634                        'uscensus' => 'U.S. Census Bureau',
4635                        'ezlocate' => 'EZLocate',
4636                        'melissa'  => 'Melissa WebSmart',
4637                        'freeside' => 'Freeside web service (support contract required)',
4638                      ],
4639   },
4640
4641   {
4642     'key'         => 'usps_webtools-userid',
4643     'section'     => 'UI',
4644     '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.',
4645     'type'        => 'text',
4646   },
4647
4648   {
4649     'key'         => 'usps_webtools-password',
4650     'section'     => 'UI',
4651     '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.',
4652     'type'        => 'text',
4653   },
4654
4655   {
4656     'key'         => 'ezlocate-userid',
4657     'section'     => 'UI',
4658     'description' => 'User ID for EZ-Locate service.  See <a href="http://www.geocode.com/">the TomTom website</a> for access and pricing information.',
4659     'type'        => 'text',
4660   },
4661
4662   {
4663     'key'         => 'ezlocate-password',
4664     'section'     => 'UI',
4665     'description' => 'Password for EZ-Locate service.',
4666     'type'        => 'text'
4667   },
4668
4669   {
4670     'key'         => 'melissa-userid',
4671     'section'     => 'UI', # it's really not...
4672     'description' => 'User ID for Melissa WebSmart service.  See <a href="http://www.melissadata.com/">the Melissa website</a> for access and pricing.',
4673     'type'        => 'text',
4674   },
4675
4676   {
4677     'key'         => 'melissa-enable_geocoding',
4678     'section'     => 'UI',
4679     'description' => 'Use the Melissa service for census tract and coordinate lookups.  Enable this only if your subscription includes geocoding access.',
4680     'type'        => 'checkbox',
4681   },
4682
4683   {
4684     'key'         => 'cust_main-auto_standardize_address',
4685     'section'     => 'UI',
4686     'description' => 'When using USPS web tools, automatically standardize the address without asking.',
4687     'type'        => 'checkbox',
4688   },
4689
4690   {
4691     'key'         => 'cust_main-require_censustract',
4692     'section'     => 'UI',
4693     'description' => 'Customer is required to have a census tract.  Useful for FCC form 477 reports. See also: cust_main-auto_standardize_address',
4694     'type'        => 'checkbox',
4695   },
4696
4697   {
4698     'key'         => 'cust_main-no_city_in_address',
4699     'section'     => 'UI',
4700     'description' => 'Turn off City for billing & shipping addresses',
4701     'type'        => 'checkbox',
4702   },
4703
4704   {
4705     'key'         => 'census_year',
4706     'section'     => 'UI',
4707     '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.',
4708     'type'        => 'select',
4709     'select_enum' => [ qw( 2013 2012 2011 ) ],
4710   },
4711
4712   {
4713     'key'         => 'tax_district_method',
4714     'section'     => 'UI',
4715     'description' => 'The method to use to look up tax district codes.',
4716     'type'        => 'select',
4717     #'select_hash' => [ FS::Misc::Geo::get_district_methods() ],
4718     #after RT#13763, using FS::Misc::Geo here now causes a dependancy loop :/
4719     'select_hash' => [
4720                        ''         => '',
4721                        'wa_sales' => 'Washington sales tax',
4722                      ],
4723   },
4724
4725   {
4726     'key'         => 'company_latitude',
4727     'section'     => 'UI',
4728     'description' => 'Your company latitude (-90 through 90)',
4729     'type'        => 'text',
4730   },
4731
4732   {
4733     'key'         => 'company_longitude',
4734     'section'     => 'UI',
4735     'description' => 'Your company longitude (-180 thru 180)',
4736     'type'        => 'text',
4737   },
4738
4739   {
4740     'key'         => 'geocode_module',
4741     'section'     => '',
4742     'description' => 'Module to geocode (retrieve a latitude and longitude for) addresses',
4743     'type'        => 'select',
4744     'select_enum' => [ 'Geo::Coder::Googlev3' ],
4745   },
4746
4747   {
4748     'key'         => 'geocode-require_nw_coordinates',
4749     'section'     => 'UI',
4750     'description' => 'Require latitude and longitude in the North Western quadrant, e.g. for North American co-ordinates, etc.',
4751     'type'        => 'checkbox',
4752   },
4753
4754   {
4755     'key'         => 'disable_acl_changes',
4756     'section'     => '',
4757     'description' => 'Disable all ACL changes, for demos.',
4758     'type'        => 'checkbox',
4759   },
4760
4761   {
4762     'key'         => 'disable_settings_changes',
4763     'section'     => '',
4764     'description' => 'Disable all settings changes, for demos, except for the usernames given in the comma-separated list.',
4765     'type'        => [qw( checkbox text )],
4766   },
4767
4768   {
4769     'key'         => 'cust_main-edit_agent_custid',
4770     'section'     => 'UI',
4771     'description' => 'Enable editing of the agent_custid field.',
4772     'type'        => 'checkbox',
4773   },
4774
4775   {
4776     'key'         => 'cust_main-default_agent_custid',
4777     'section'     => 'UI',
4778     'description' => 'Display the agent_custid field when available instead of the custnum field.  Restart Apache after changing.',
4779     'type'        => 'checkbox',
4780   },
4781
4782   {
4783     'key'         => 'cust_main-title-display_custnum',
4784     'section'     => 'UI',
4785     'description' => 'Add the display_custom (agent_custid or custnum) to the title on customer view pages.',
4786     'type'        => 'checkbox',
4787   },
4788
4789   {
4790     'key'         => 'cust_bill-default_agent_invid',
4791     'section'     => 'UI',
4792     'description' => 'Display the agent_invid field when available instead of the invnum field.',
4793     'type'        => 'checkbox',
4794   },
4795
4796   {
4797     'key'         => 'cust_main-auto_agent_custid',
4798     'section'     => 'UI',
4799     'description' => 'Automatically assign an agent_custid - select format',
4800     'type'        => 'select',
4801     'select_hash' => [ '' => 'No',
4802                        '1YMMXXXXXXXX' => '1YMMXXXXXXXX',
4803                      ],
4804   },
4805
4806   {
4807     'key'         => 'cust_main-custnum-display_prefix',
4808     'section'     => 'UI',
4809     'description' => 'Prefix the customer number with this string for display purposes.',
4810     'type'        => 'text',
4811     'per_agent'   => 1,
4812   },
4813
4814   {
4815     'key'         => 'cust_main-custnum-display_length',
4816     'section'     => 'UI',
4817     'description' => 'Zero fill the customer number to this many digits for display purposes.  Restart Apache after changing.',
4818     'type'        => 'text',
4819   },
4820
4821   {
4822     'key'         => 'cust_main-default_areacode',
4823     'section'     => 'UI',
4824     'description' => 'Default area code for customers.',
4825     'type'        => 'text',
4826   },
4827
4828   {
4829     'key'         => 'order_pkg-no_start_date',
4830     'section'     => 'UI',
4831     'description' => 'Don\'t set a default start date for new packages.',
4832     'type'        => 'checkbox',
4833   },
4834
4835   {
4836     'key'         => 'part_pkg-delay_start',
4837     'section'     => '',
4838     'description' => 'Enabled "delayed start" option for packages.',
4839     'type'        => 'checkbox',
4840   },
4841
4842   {
4843     'key'         => 'part_pkg-delay_cancel-days',
4844     'section'     => '',
4845     'description' => 'Number of days to suspend when using automatic suspension period before cancel (default is 1)',
4846     'type'        => 'text',
4847     'validate'    => sub { (($_[0] =~ /^\d*$/) && (($_[0] eq '') || $_[0]))
4848                            ? ''
4849                            : 'Must specify an integer number of days' }
4850   },
4851
4852   {
4853     'key'         => 'mcp_svcpart',
4854     'section'     => '',
4855     'description' => 'Master Control Program svcpart.  Leave this blank.',
4856     'type'        => 'text', #select-part_svc
4857   },
4858
4859   {
4860     'key'         => 'cust_bill-max_same_services',
4861     'section'     => 'invoicing',
4862     '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.',
4863     'type'        => 'text',
4864   },
4865
4866   {
4867     'key'         => 'cust_bill-consolidate_services',
4868     'section'     => 'invoicing',
4869     'description' => 'Consolidate service display into fewer lines on invoices rather than one per service.',
4870     'type'        => 'checkbox',
4871   },
4872
4873   {
4874     'key'         => 'suspend_email_admin',
4875     'section'     => '',
4876     'description' => 'Destination admin email address to enable suspension notices',
4877     'type'        => 'text',
4878   },
4879
4880   {
4881     'key'         => 'unsuspend_email_admin',
4882     'section'     => '',
4883     'description' => 'Destination admin email address to enable unsuspension notices',
4884     'type'        => 'text',
4885   },
4886   
4887   {
4888     'key'         => 'email_report-subject',
4889     'section'     => '',
4890     'description' => 'Subject for reports emailed by freeside-fetch.  Defaults to "Freeside report".',
4891     'type'        => 'text',
4892   },
4893
4894   {
4895     'key'         => 'selfservice-head',
4896     'section'     => 'self-service',
4897     'description' => 'HTML for the HEAD section of the self-service interface, typically used for LINK stylesheet tags',
4898     'type'        => 'textarea', #htmlarea?
4899     'per_agent'   => 1,
4900   },
4901
4902
4903   {
4904     'key'         => 'selfservice-body_header',
4905     'section'     => 'self-service',
4906     'description' => 'HTML header for the self-service interface',
4907     'type'        => 'textarea', #htmlarea?
4908     'per_agent'   => 1,
4909   },
4910
4911   {
4912     'key'         => 'selfservice-body_footer',
4913     'section'     => 'self-service',
4914     'description' => 'HTML footer for the self-service interface',
4915     'type'        => 'textarea', #htmlarea?
4916     'per_agent'   => 1,
4917   },
4918
4919
4920   {
4921     'key'         => 'selfservice-body_bgcolor',
4922     'section'     => 'self-service',
4923     'description' => 'HTML background color for the self-service interface, for example, #FFFFFF',
4924     'type'        => 'text',
4925     'per_agent'   => 1,
4926   },
4927
4928   {
4929     'key'         => 'selfservice-box_bgcolor',
4930     'section'     => 'self-service',
4931     'description' => 'HTML color for self-service interface input boxes, for example, #C0C0C0',
4932     'type'        => 'text',
4933     'per_agent'   => 1,
4934   },
4935
4936   {
4937     'key'         => 'selfservice-stripe1_bgcolor',
4938     'section'     => 'self-service',
4939     'description' => 'HTML color for self-service interface lists (primary stripe), for example, #FFFFFF',
4940     'type'        => 'text',
4941     'per_agent'   => 1,
4942   },
4943
4944   {
4945     'key'         => 'selfservice-stripe2_bgcolor',
4946     'section'     => 'self-service',
4947     'description' => 'HTML color for self-service interface lists (alternate stripe), for example, #DDDDDD',
4948     'type'        => 'text',
4949     'per_agent'   => 1,
4950   },
4951
4952   {
4953     'key'         => 'selfservice-text_color',
4954     'section'     => 'self-service',
4955     'description' => 'HTML text color for the self-service interface, for example, #000000',
4956     'type'        => 'text',
4957     'per_agent'   => 1,
4958   },
4959
4960   {
4961     'key'         => 'selfservice-link_color',
4962     'section'     => 'self-service',
4963     'description' => 'HTML link color for the self-service interface, for example, #0000FF',
4964     'type'        => 'text',
4965     'per_agent'   => 1,
4966   },
4967
4968   {
4969     'key'         => 'selfservice-vlink_color',
4970     'section'     => 'self-service',
4971     'description' => 'HTML visited link color for the self-service interface, for example, #FF00FF',
4972     'type'        => 'text',
4973     'per_agent'   => 1,
4974   },
4975
4976   {
4977     'key'         => 'selfservice-hlink_color',
4978     'section'     => 'self-service',
4979     'description' => 'HTML hover link color for the self-service interface, for example, #808080',
4980     'type'        => 'text',
4981     'per_agent'   => 1,
4982   },
4983
4984   {
4985     'key'         => 'selfservice-alink_color',
4986     'section'     => 'self-service',
4987     'description' => 'HTML active (clicked) link color for the self-service interface, for example, #808080',
4988     'type'        => 'text',
4989     'per_agent'   => 1,
4990   },
4991
4992   {
4993     'key'         => 'selfservice-font',
4994     'section'     => 'self-service',
4995     'description' => 'HTML font CSS for the self-service interface, for example, 0.9em/1.5em Arial, Helvetica, Geneva, sans-serif',
4996     'type'        => 'text',
4997     'per_agent'   => 1,
4998   },
4999
5000   {
5001     'key'         => 'selfservice-no_logo',
5002     'section'     => 'self-service',
5003     'description' => 'Disable the logo in self-service',
5004     'type'        => 'checkbox',
5005     'per_agent'   => 1,
5006   },
5007
5008   {
5009     'key'         => 'selfservice-title_color',
5010     'section'     => 'self-service',
5011     'description' => 'HTML color for the self-service title, for example, #000000',
5012     'type'        => 'text',
5013     'per_agent'   => 1,
5014   },
5015
5016   {
5017     'key'         => 'selfservice-title_align',
5018     'section'     => 'self-service',
5019     'description' => 'HTML alignment for the self-service title, for example, center',
5020     'type'        => 'text',
5021     'per_agent'   => 1,
5022   },
5023   {
5024     'key'         => 'selfservice-title_size',
5025     'section'     => 'self-service',
5026     'description' => 'HTML font size for the self-service title, for example, 3',
5027     'type'        => 'text',
5028     'per_agent'   => 1,
5029   },
5030
5031   {
5032     'key'         => 'selfservice-title_left_image',
5033     'section'     => 'self-service',
5034     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
5035     'type'        => 'image',
5036     'per_agent'   => 1,
5037   },
5038
5039   {
5040     'key'         => 'selfservice-title_right_image',
5041     'section'     => 'self-service',
5042     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
5043     'type'        => 'image',
5044     'per_agent'   => 1,
5045   },
5046
5047   {
5048     'key'         => 'selfservice-menu_disable',
5049     'section'     => 'self-service',
5050     'description' => 'Disable the selected menu entries in the self-service menu',
5051     'type'        => 'selectmultiple',
5052     'select_enum' => [ #false laziness w/myaccount_menu.html
5053                        'Overview',
5054                        'Purchase',
5055                        'Purchase additional package',
5056                        'Recharge my account with a credit card',
5057                        'Recharge my account with a check',
5058                        'Recharge my account with a prepaid card',
5059                        'View my usage',
5060                        'Create a ticket',
5061                        'Setup my services',
5062                        'Change my information',
5063                        'Change billing address',
5064                        'Change service address',
5065                        'Change payment information',
5066                        'Change password(s)',
5067                        'Logout',
5068                      ],
5069     'per_agent'   => 1,
5070   },
5071
5072   {
5073     'key'         => 'selfservice-menu_skipblanks',
5074     'section'     => 'self-service',
5075     'description' => 'Skip blank (spacer) entries in the self-service menu',
5076     'type'        => 'checkbox',
5077     'per_agent'   => 1,
5078   },
5079
5080   {
5081     'key'         => 'selfservice-menu_skipheadings',
5082     'section'     => 'self-service',
5083     'description' => 'Skip the unclickable heading entries in the self-service menu',
5084     'type'        => 'checkbox',
5085     'per_agent'   => 1,
5086   },
5087
5088   {
5089     'key'         => 'selfservice-menu_bgcolor',
5090     'section'     => 'self-service',
5091     'description' => 'HTML color for the self-service menu, for example, #C0C0C0',
5092     'type'        => 'text',
5093     'per_agent'   => 1,
5094   },
5095
5096   {
5097     'key'         => 'selfservice-menu_fontsize',
5098     'section'     => 'self-service',
5099     'description' => 'HTML font size for the self-service menu, for example, -1',
5100     'type'        => 'text',
5101     'per_agent'   => 1,
5102   },
5103   {
5104     'key'         => 'selfservice-menu_nounderline',
5105     'section'     => 'self-service',
5106     'description' => 'Styles menu links in the self-service without underlining.',
5107     'type'        => 'checkbox',
5108     'per_agent'   => 1,
5109   },
5110
5111
5112   {
5113     'key'         => 'selfservice-menu_top_image',
5114     'section'     => 'self-service',
5115     'description' => 'Image used for the top of the menu in the self-service interface, in PNG format.',
5116     'type'        => 'image',
5117     'per_agent'   => 1,
5118   },
5119
5120   {
5121     'key'         => 'selfservice-menu_body_image',
5122     'section'     => 'self-service',
5123     'description' => 'Repeating image used for the body of the menu in the self-service interface, in PNG format.',
5124     'type'        => 'image',
5125     'per_agent'   => 1,
5126   },
5127
5128   {
5129     'key'         => 'selfservice-menu_bottom_image',
5130     'section'     => 'self-service',
5131     'description' => 'Image used for the bottom of the menu in the self-service interface, in PNG format.',
5132     'type'        => 'image',
5133     'per_agent'   => 1,
5134   },
5135   
5136   {
5137     'key'         => 'selfservice-view_usage_nodomain',
5138     'section'     => 'self-service',
5139     'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.',
5140     'type'        => 'checkbox',
5141   },
5142
5143   {
5144     'key'         => 'selfservice-login_banner_image',
5145     'section'     => 'self-service',
5146     'description' => 'Banner image shown on the login page, in PNG format.',
5147     'type'        => 'image',
5148   },
5149
5150   {
5151     'key'         => 'selfservice-login_banner_url',
5152     'section'     => 'self-service',
5153     'description' => 'Link for the login banner.',
5154     'type'        => 'text',
5155   },
5156
5157   {
5158     'key'         => 'ng_selfservice-menu',
5159     'section'     => 'self-service',
5160     '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
5161     'type'        => 'textarea',
5162   },
5163
5164   {
5165     'key'         => 'signup-no_company',
5166     'section'     => 'self-service',
5167     'description' => "Don't display a field for company name on signup.",
5168     'type'        => 'checkbox',
5169   },
5170
5171   {
5172     'key'         => 'signup-recommend_email',
5173     'section'     => 'self-service',
5174     'description' => 'Encourage the entry of an invoicing email address on signup.',
5175     'type'        => 'checkbox',
5176   },
5177
5178   {
5179     'key'         => 'signup-recommend_daytime',
5180     'section'     => 'self-service',
5181     'description' => 'Encourage the entry of a daytime phone number on signup.',
5182     'type'        => 'checkbox',
5183   },
5184
5185   {
5186     'key'         => 'signup-duplicate_cc-warn_hours',
5187     'section'     => 'self-service',
5188     'description' => 'Issue a warning if the same credit card is used for multiple signups within this many hours.',
5189     'type'        => 'text',
5190   },
5191
5192   {
5193     'key'         => 'svc_phone-radius-password',
5194     'section'     => 'telephony',
5195     'description' => 'Password when exporting svc_phone records to RADIUS',
5196     'type'        => 'select',
5197     'select_hash' => [
5198       '' => 'Use default from svc_phone-radius-default_password config',
5199       'countrycode_phonenum' => 'Phone number (with country code)',
5200     ],
5201   },
5202
5203   {
5204     'key'         => 'svc_phone-radius-default_password',
5205     'section'     => 'telephony',
5206     'description' => 'Default password when exporting svc_phone records to RADIUS',
5207     'type'        => 'text',
5208   },
5209
5210   {
5211     'key'         => 'svc_phone-allow_alpha_phonenum',
5212     'section'     => 'telephony',
5213     'description' => 'Allow letters in phone numbers.',
5214     'type'        => 'checkbox',
5215   },
5216
5217   {
5218     'key'         => 'svc_phone-domain',
5219     'section'     => 'telephony',
5220     'description' => 'Track an optional domain association with each phone service.',
5221     'type'        => 'checkbox',
5222   },
5223
5224   {
5225     'key'         => 'svc_phone-phone_name-max_length',
5226     'section'     => 'telephony',
5227     '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.',
5228     'type'        => 'text',
5229   },
5230
5231   {
5232     'key'         => 'svc_phone-random_pin',
5233     'section'     => 'telephony',
5234     'description' => 'Number of random digits to generate in the "PIN" field, if empty.',
5235     'type'        => 'text',
5236   },
5237
5238   {
5239     'key'         => 'svc_phone-lnp',
5240     'section'     => 'telephony',
5241     'description' => 'Enables Number Portability features for svc_phone',
5242     'type'        => 'checkbox',
5243   },
5244
5245   {
5246     'key'         => 'svc_phone-bulk_provision_simple',
5247     'section'     => 'telephony',
5248     'description' => 'Bulk provision phone numbers with a simple number range instead of from DID vendor orders',
5249     'type'        => 'checkbox',
5250   },
5251
5252   {
5253     'key'         => 'default_phone_countrycode',
5254     'section'     => 'telephony',
5255     'description' => 'Default countrycode',
5256     'type'        => 'text',
5257   },
5258
5259   {
5260     'key'         => 'cdr-charged_party-field',
5261     'section'     => 'telephony',
5262     'description' => 'Set the charged_party field of CDRs to this field.',
5263     'type'        => 'select-sub',
5264     'options_sub' => sub { my $fields = FS::cdr->table_info->{'fields'};
5265                            map { $_ => $fields->{$_}||$_ }
5266                            grep { $_ !~ /^(acctid|charged_party)$/ }
5267                            FS::Schema::dbdef->table('cdr')->columns;
5268                          },
5269     'option_sub'  => sub { my $f = shift;
5270                            FS::cdr->table_info->{'fields'}{$f} || $f;
5271                          },
5272   },
5273
5274   #probably deprecate in favor of cdr-charged_party-field above
5275   {
5276     'key'         => 'cdr-charged_party-accountcode',
5277     'section'     => 'telephony',
5278     'description' => 'Set the charged_party field of CDRs to the accountcode.',
5279     'type'        => 'checkbox',
5280   },
5281
5282   {
5283     'key'         => 'cdr-charged_party-accountcode-trim_leading_0s',
5284     'section'     => 'telephony',
5285     'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
5286     'type'        => 'checkbox',
5287   },
5288
5289 #  {
5290 #    'key'         => 'cdr-charged_party-truncate_prefix',
5291 #    'section'     => '',
5292 #    'description' => 'If the charged_party field has this prefix, truncate it to the length in cdr-charged_party-truncate_length.',
5293 #    'type'        => 'text',
5294 #  },
5295 #
5296 #  {
5297 #    'key'         => 'cdr-charged_party-truncate_length',
5298 #    'section'     => '',
5299 #    'description' => 'If the charged_party field has the prefix in cdr-charged_party-truncate_prefix, truncate it to this length.',
5300 #    'type'        => 'text',
5301 #  },
5302
5303   {
5304     'key'         => 'cdr-charged_party_rewrite',
5305     'section'     => 'telephony',
5306     '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*.',
5307     'type'        => 'checkbox',
5308   },
5309
5310   {
5311     'key'         => 'cdr-taqua-da_rewrite',
5312     'section'     => 'telephony',
5313     '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.',
5314     'type'        => 'text',
5315   },
5316
5317   {
5318     'key'         => 'cdr-taqua-accountcode_rewrite',
5319     'section'     => 'telephony',
5320     'description' => 'For the Taqua CDR format, pull accountcodes from secondary CDRs with matching sessionNumber.',
5321     'type'        => 'checkbox',
5322   },
5323
5324   {
5325     'key'         => 'cdr-taqua-callerid_rewrite',
5326     'section'     => 'telephony',
5327     'description' => 'For the Taqua CDR format, pull Caller ID blocking information from secondary CDRs.',
5328     'type'        => 'checkbox',
5329   },
5330
5331   {
5332     'key'         => 'cdr-asterisk_australia_rewrite',
5333     'section'     => 'telephony',
5334     'description' => 'For Asterisk CDRs, assign CDR type numbers based on Australian conventions.',
5335     'type'        => 'checkbox',
5336   },
5337
5338   {
5339     'key'         => 'cdr-userfield_dnis_rewrite',
5340     'section'     => 'telephony',
5341     'description' => 'If the CDR userfield contains "DNIS=" followed by a sequence of digits, use that as the destination number for the call.',
5342     'type'        => 'checkbox',
5343   },
5344
5345   {
5346     'key'         => 'cdr-intl_to_domestic_rewrite',
5347     'section'     => 'telephony',
5348     '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.',
5349     'type'        => 'checkbox',
5350   },
5351
5352   {
5353     'key'         => 'cdr-gsm_tap3-sender',
5354     'section'     => 'telephony',
5355     'description' => 'GSM TAP3 Sender network (5 letter code)',
5356     'type'        => 'text',
5357   },
5358
5359   {
5360     'key'         => 'cust_pkg-show_autosuspend',
5361     'section'     => 'UI',
5362     'description' => 'Show package auto-suspend dates.  Use with caution for now; can slow down customer view for large insallations.',
5363     'type'        => 'checkbox',
5364   },
5365
5366   {
5367     'key'         => 'cdr-asterisk_forward_rewrite',
5368     'section'     => 'telephony',
5369     '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").',
5370     'type'        => 'checkbox',
5371   },
5372
5373   {
5374     'key'         => 'mc-outbound_packages',
5375     'section'     => '',
5376     'description' => "Don't use this.",
5377     'type'        => 'select-part_pkg',
5378     'multiple'    => 1,
5379   },
5380
5381   {
5382     'key'         => 'disable-cust-pkg_class',
5383     'section'     => 'UI',
5384     'description' => 'Disable the two-step dropdown for selecting package class and package, and return to the classic single dropdown.',
5385     'type'        => 'checkbox',
5386   },
5387
5388   {
5389     'key'         => 'queued-max_kids',
5390     'section'     => '',
5391     'description' => 'Maximum number of queued processes.  Defaults to 10.',
5392     'type'        => 'text',
5393   },
5394
5395   {
5396     'key'         => 'queued-sleep_time',
5397     'section'     => '',
5398     '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.',
5399     'type'        => 'text',
5400   },
5401
5402   {
5403     'key'         => 'queue-no_history',
5404     'section'     => '',
5405     '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.",
5406     'type'        => 'checkbox',
5407   },
5408
5409   {
5410     'key'         => 'cancelled_cust-noevents',
5411     'section'     => 'billing',
5412     'description' => "Don't run events for cancelled customers",
5413     'type'        => 'checkbox',
5414   },
5415
5416   {
5417     'key'         => 'agent-invoice_template',
5418     'section'     => 'invoicing',
5419     'description' => 'Enable display/edit of old-style per-agent invoice template selection',
5420     'type'        => 'checkbox',
5421   },
5422
5423   {
5424     'key'         => 'svc_broadband-manage_link',
5425     'section'     => 'UI',
5426     'description' => 'URL for svc_broadband "Manage Device" link.  The following substitutions are available: $ip_addr and $mac_addr.',
5427     'type'        => 'text',
5428   },
5429
5430   {
5431     'key'         => 'svc_broadband-manage_link_text',
5432     'section'     => 'UI',
5433     'description' => 'Label for "Manage Device" link',
5434     'type'        => 'text',
5435   },
5436
5437   {
5438     'key'         => 'svc_broadband-manage_link_loc',
5439     'section'     => 'UI',
5440     'description' => 'Location for "Manage Device" link',
5441     'type'        => 'select',
5442     'select_hash' => [
5443       'bottom' => 'Near Unprovision link',
5444       'right'  => 'With export-related links',
5445     ],
5446   },
5447
5448   {
5449     'key'         => 'svc_broadband-manage_link-new_window',
5450     'section'     => 'UI',
5451     'description' => 'Open the "Manage Device" link in a new window',
5452     'type'        => 'checkbox',
5453   },
5454
5455   #more fine-grained, service def-level control could be useful eventually?
5456   {
5457     'key'         => 'svc_broadband-allow_null_ip_addr',
5458     'section'     => '',
5459     'description' => '',
5460     'type'        => 'checkbox',
5461   },
5462
5463   {
5464     'key'         => 'svc_hardware-check_mac_addr',
5465     'section'     => '', #?
5466     'description' => 'Require the "hardware address" field in hardware services to be a valid MAC address.',
5467     'type'        => 'checkbox',
5468   },
5469
5470   {
5471     'key'         => 'tax-report_groups',
5472     'section'     => '',
5473     'description' => 'List of grouping possibilities for tax names on reports, one per line, "label op value" (op can be = or !=).',
5474     'type'        => 'textarea',
5475   },
5476
5477   {
5478     'key'         => 'tax-cust_exempt-groups',
5479     'section'     => 'billing',
5480     '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).',
5481     'type'        => 'textarea',
5482   },
5483
5484   {
5485     'key'         => 'tax-cust_exempt-groups-require_individual_nums',
5486     'section'     => 'deprecated',
5487     'description' => 'Deprecated: see tax-cust_exempt-groups-num_req',
5488     'type'        => 'checkbox',
5489   },
5490
5491   {
5492     'key'         => 'tax-cust_exempt-groups-num_req',
5493     'section'     => 'billing',
5494     'description' => 'When using tax-cust_exempt-groups, control whether individual tax exemption numbers are required for exemption from different taxes.',
5495     'type'        => 'select',
5496     'select_hash' => [ ''            => 'Not required',
5497                        'residential' => 'Required for residential customers only',
5498                        'all'         => 'Required for all customers',
5499                      ],
5500   },
5501
5502   {
5503     'key'         => 'tax-round_per_line_item',
5504     'section'     => 'billing',
5505     'description' => 'Calculate tax and round to the nearest cent for each line item, rather than for the whole invoice.',
5506     'type'        => 'checkbox',
5507   },
5508
5509   {
5510     'key'         => 'cust_main-default_view',
5511     'section'     => 'UI',
5512     'description' => 'Default customer view, for users who have not selected a default view in their preferences.',
5513     'type'        => 'select',
5514     'select_hash' => [
5515       #false laziness w/view/cust_main.cgi and pref/pref.html
5516       'basics'          => 'Basics',
5517       'notes'           => 'Notes',
5518       'tickets'         => 'Tickets',
5519       'packages'        => 'Packages',
5520       'payment_history' => 'Payment History',
5521       'change_history'  => 'Change History',
5522       'jumbo'           => 'Jumbo',
5523     ],
5524   },
5525
5526   {
5527     'key'         => 'enable_tax_adjustments',
5528     'section'     => 'billing',
5529     'description' => 'Enable the ability to add manual tax adjustments.',
5530     'type'        => 'checkbox',
5531   },
5532
5533   {
5534     'key'         => 'rt-crontool',
5535     'section'     => '',
5536     'description' => 'Enable the RT CronTool extension.',
5537     'type'        => 'checkbox',
5538   },
5539
5540   {
5541     'key'         => 'pkg-balances',
5542     'section'     => 'billing',
5543     'description' => 'Enable per-package balances.',
5544     'type'        => 'checkbox',
5545   },
5546
5547   {
5548     'key'         => 'pkg-addon_classnum',
5549     'section'     => 'billing',
5550     'description' => 'Enable the ability to restrict additional package orders based on package class.',
5551     'type'        => 'checkbox',
5552   },
5553
5554   {
5555     'key'         => 'cust_main-edit_signupdate',
5556     'section'     => 'UI',
5557     'description' => 'Enable manual editing of the signup date.',
5558     'type'        => 'checkbox',
5559   },
5560
5561   {
5562     'key'         => 'svc_acct-disable_access_number',
5563     'section'     => 'UI',
5564     'description' => 'Disable access number selection.',
5565     'type'        => 'checkbox',
5566   },
5567
5568   {
5569     'key'         => 'cust_bill_pay_pkg-manual',
5570     'section'     => 'UI',
5571     'description' => 'Allow manual application of payments to line items.',
5572     'type'        => 'checkbox',
5573   },
5574
5575   {
5576     'key'         => 'cust_credit_bill_pkg-manual',
5577     'section'     => 'UI',
5578     'description' => 'Allow manual application of credits to line items.',
5579     'type'        => 'checkbox',
5580   },
5581
5582   {
5583     'key'         => 'breakage-days',
5584     'section'     => 'billing',
5585     '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.',
5586     'type'        => 'text',
5587     'per_agent'   => 1,
5588   },
5589
5590   {
5591     'key'         => 'breakage-pkg_class',
5592     'section'     => 'billing',
5593     'description' => 'Package class to use for breakage reconciliation.',
5594     'type'        => 'select-pkg_class',
5595   },
5596
5597   {
5598     'key'         => 'disable_cron_billing',
5599     'section'     => 'billing',
5600     '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.',
5601     'type'        => 'checkbox',
5602   },
5603
5604   {
5605     'key'         => 'svc_domain-edit_domain',
5606     'section'     => '',
5607     'description' => 'Enable domain renaming',
5608     'type'        => 'checkbox',
5609   },
5610
5611   {
5612     'key'         => 'enable_legacy_prepaid_income',
5613     'section'     => '',
5614     '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.",
5615     'type'        => 'checkbox',
5616   },
5617
5618   {
5619     'key'         => 'cust_main-exports',
5620     'section'     => '',
5621     'description' => 'Export(s) to call on cust_main insert, modification and deletion.',
5622     'type'        => 'select-sub',
5623     'multiple'    => 1,
5624     'options_sub' => sub {
5625       require FS::Record;
5626       require FS::part_export;
5627       my @part_export =
5628         map { qsearch( 'part_export', {exporttype => $_ } ) }
5629           keys %{FS::part_export::export_info('cust_main')};
5630       map { $_->exportnum => $_->exportname } @part_export;
5631     },
5632     'option_sub'  => sub {
5633       require FS::Record;
5634       require FS::part_export;
5635       my $part_export = FS::Record::qsearchs(
5636         'part_export', { 'exportnum' => shift }
5637       );
5638       $part_export
5639         ? $part_export->exportname
5640         : '';
5641     },
5642   },
5643
5644   #false laziness w/above options_sub and option_sub
5645   {
5646     'key'         => 'cust_location-exports',
5647     'section'     => '',
5648     'description' => 'Export(s) to call on cust_location insert or modification',
5649     'type'        => 'select-sub',
5650     'multiple'    => 1,
5651     'options_sub' => sub {
5652       require FS::Record;
5653       require FS::part_export;
5654       my @part_export =
5655         map { qsearch( 'part_export', {exporttype => $_ } ) }
5656           keys %{FS::part_export::export_info('cust_location')};
5657       map { $_->exportnum => $_->exportname } @part_export;
5658     },
5659     'option_sub'  => sub {
5660       require FS::Record;
5661       require FS::part_export;
5662       my $part_export = FS::Record::qsearchs(
5663         'part_export', { 'exportnum' => shift }
5664       );
5665       $part_export
5666         ? $part_export->exportname
5667         : '';
5668     },
5669   },
5670
5671   {
5672     'key'         => 'cust_tag-location',
5673     'section'     => 'UI',
5674     'description' => 'Location where customer tags are displayed.',
5675     'type'        => 'select',
5676     'select_enum' => [ 'misc_info', 'top' ],
5677   },
5678
5679   {
5680     'key'         => 'cust_main-custom_link',
5681     'section'     => 'UI',
5682     '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.',
5683     'type'        => 'textarea',
5684   },
5685
5686   {
5687     'key'         => 'cust_main-custom_content',
5688     'section'     => 'UI',
5689     '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.',
5690     'type'        => 'textarea',
5691   },
5692
5693   {
5694     'key'         => 'cust_main-custom_title',
5695     'section'     => 'UI',
5696     'description' => 'Title for the "Custom" tab in the View Customer page.',
5697     'type'        => 'text',
5698   },
5699
5700   {
5701     'key'         => 'part_pkg-default_suspend_bill',
5702     'section'     => 'billing',
5703     'description' => 'Default the "Continue recurring billing while suspended" flag to on for new package definitions.',
5704     'type'        => 'checkbox',
5705   },
5706   
5707   {
5708     'key'         => 'qual-alt_address_format',
5709     'section'     => 'UI',
5710     'description' => 'Enable the alternate address format (location type, number, and kind) for qualifications.',
5711     'type'        => 'checkbox',
5712   },
5713
5714   {
5715     'key'         => 'prospect_main-alt_address_format',
5716     'section'     => 'UI',
5717     '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.',
5718     'type'        => 'checkbox',
5719   },
5720
5721   {
5722     'key'         => 'prospect_main-location_required',
5723     'section'     => 'UI',
5724     'description' => 'Require an address for prospects.  Recommended if the main use of propects is for qualifications.',
5725     'type'        => 'checkbox',
5726   },
5727
5728   {
5729     'key'         => 'note-classes',
5730     'section'     => 'UI',
5731     'description' => 'Use customer note classes',
5732     'type'        => 'select',
5733     'select_hash' => [
5734                        0 => 'Disabled',
5735                        1 => 'Enabled',
5736                        2 => 'Enabled, with tabs',
5737                      ],
5738   },
5739
5740   {
5741     'key'         => 'svc_acct-cf_privatekey-message',
5742     'section'     => '',
5743     'description' => 'For internal use: HTML displayed when cf_privatekey field is set.',
5744     'type'        => 'textarea',
5745   },
5746
5747   {
5748     'key'         => 'menu-prepend_links',
5749     'section'     => 'UI',
5750     'description' => 'Links to prepend to the main menu, one per line, with format "URL Link Label (optional ALT popup)".',
5751     'type'        => 'textarea',
5752   },
5753
5754   {
5755     'key'         => 'cust_main-external_links',
5756     'section'     => 'UI',
5757     'description' => 'External links available in customer view, one per line, with format "URL Link Label (optional ALT popup)".  The URL will have custnum appended.',
5758     'type'        => 'textarea',
5759   },
5760   
5761   {
5762     'key'         => 'svc_phone-did-summary',
5763     'section'     => 'invoicing',
5764     '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.',
5765     'type'        => 'checkbox',
5766   },
5767
5768   {
5769     'key'         => 'svc_acct-usage_seconds',
5770     'section'     => 'invoicing',
5771     'description' => 'Enable calculation of RADIUS usage time for invoices.  You must modify your template to display this information.',
5772     'type'        => 'checkbox',
5773   },
5774   
5775   {
5776     'key'         => 'opensips_gwlist',
5777     'section'     => 'telephony',
5778     'description' => 'For svc_phone OpenSIPS dr_rules export, gwlist column value, per-agent',
5779     'type'        => 'text',
5780     'per_agent'   => 1,
5781     'agentonly'   => 1,
5782   },
5783
5784   {
5785     'key'         => 'opensips_description',
5786     'section'     => 'telephony',
5787     'description' => 'For svc_phone OpenSIPS dr_rules export, description column value, per-agent',
5788     'type'        => 'text',
5789     'per_agent'   => 1,
5790     'agentonly'   => 1,
5791   },
5792   
5793   {
5794     'key'         => 'opensips_route',
5795     'section'     => 'telephony',
5796     'description' => 'For svc_phone OpenSIPS dr_rules export, routeid column value, per-agent',
5797     'type'        => 'text',
5798     'per_agent'   => 1,
5799     'agentonly'   => 1,
5800   },
5801
5802   {
5803     'key'         => 'cust_bill-no_recipients-error',
5804     'section'     => 'invoicing',
5805     '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.',
5806     'type'        => 'checkbox',
5807   },
5808
5809   {
5810     'key'         => 'cust_bill-latex_lineitem_maxlength',
5811     'section'     => 'deprecated',
5812     'description' => 'With old invoice_latex template, truncate long line items to this number of characters on typeset invoices, to avoid losing things off the right margin.  Defaults to 50.  (With current invoice_latex template, this is handled internally in the template itself instead.)',
5813     'type'        => 'text',
5814   },
5815
5816   {
5817     'key'         => 'invoice_payment_details',
5818     'section'     => 'invoicing',
5819     '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.',
5820     'type'        => 'checkbox',
5821   },
5822
5823   {
5824     'key'         => 'cust_main-status_module',
5825     'section'     => 'UI',
5826     '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?
5827     'type'        => 'select',
5828     'select_enum' => [ 'Classic', 'Recurring' ],
5829   },
5830
5831   { 
5832     'key'         => 'username-pound',
5833     'section'     => 'username',
5834     'description' => 'Allow the pound character (#) in usernames.',
5835     'type'        => 'checkbox',
5836   },
5837
5838   { 
5839     'key'         => 'username-exclamation',
5840     'section'     => 'username',
5841     'description' => 'Allow the exclamation character (!) in usernames.',
5842     'type'        => 'checkbox',
5843   },
5844
5845   {
5846     'key'         => 'ie-compatibility_mode',
5847     'section'     => 'UI',
5848     '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.",
5849     'type'        => 'select',
5850     'select_enum' => [ '', '7', 'EmulateIE7', '8', 'EmulateIE8' ],
5851   },
5852
5853   {
5854     'key'         => 'disable_payauto_default',
5855     'section'     => 'UI',
5856     'description' => 'Disable the "Charge future payments to this (card|check) automatically" checkbox from defaulting to checked.',
5857     'type'        => 'checkbox',
5858   },
5859   
5860   {
5861     'key'         => 'payment-history-report',
5862     'section'     => 'UI',
5863     'description' => 'Show a link to the raw database payment history report in the Reports menu.  DO NOT ENABLE THIS for modern installations.',
5864     'type'        => 'checkbox',
5865   },
5866   
5867   {
5868     'key'         => 'svc_broadband-require-nw-coordinates',
5869     'section'     => 'deprecated',
5870     'description' => 'Deprecated; see geocode-require_nw_coordinates instead',
5871     'type'        => 'checkbox',
5872   },
5873   
5874   {
5875     'key'         => 'cust-email-high-visibility',
5876     'section'     => 'UI',
5877     'description' => 'Move the invoicing e-mail address field to the top of the billing address section and highlight it.',
5878     'type'        => 'checkbox',
5879   },
5880   
5881   {
5882     'key'         => 'cust-edit-alt-field-order',
5883     'section'     => 'UI',
5884     'description' => 'An alternate ordering of fields for the New Customer and Edit Customer screens.',
5885     'type'        => 'checkbox',
5886   },
5887
5888   {
5889     'key'         => 'cust_bill-enable_promised_date',
5890     'section'     => 'UI',
5891     'description' => 'Enable display/editing of the "promised payment date" field on invoices.',
5892     'type'        => 'checkbox',
5893   },
5894   
5895   {
5896     'key'         => 'available-locales',
5897     'section'     => '',
5898     'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
5899     'type'        => 'select-sub',
5900     'multiple'    => 1,
5901     'options_sub' => sub { 
5902       map { $_ => FS::Locales->description($_) }
5903       FS::Locales->locales;
5904     },
5905     'option_sub'  => sub { FS::Locales->description(shift) },
5906   },
5907
5908   {
5909     'key'         => 'cust_main-require_locale',
5910     'section'     => 'UI',
5911     'description' => 'Require an explicit locale to be chosen for new customers.',
5912     'type'        => 'checkbox',
5913   },
5914   
5915   {
5916     'key'         => 'translate-auto-insert',
5917     'section'     => '',
5918     '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.',
5919     'type'        => 'select',
5920     'multiple'    => 1,
5921     'select_enum' => [ grep { $_ ne 'en_US' } FS::Locales::locales ],
5922   },
5923
5924   {
5925     'key'         => 'svc_acct-tower_sector',
5926     'section'     => '',
5927     'description' => 'Track tower and sector for svc_acct (account) services.',
5928     'type'        => 'checkbox',
5929   },
5930
5931   {
5932     'key'         => 'cdr-prerate',
5933     'section'     => 'telephony',
5934     '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.',
5935     'type'        => 'checkbox',
5936   },
5937
5938   {
5939     'key'         => 'cdr-prerate-cdrtypenums',
5940     'section'     => 'telephony',
5941     'description' => 'When using cdr-prerate to rate CDRs immediately, limit processing to these CDR types.',
5942     'type'        => 'select-sub',
5943     'multiple'    => 1,
5944     'options_sub' => sub { require FS::Record;
5945                            require FS::cdr_type;
5946                            map { $_->cdrtypenum => $_->cdrtypename }
5947                                FS::Record::qsearch( 'cdr_type', 
5948                                                     {} #{ 'disabled' => '' }
5949                                                   );
5950                          },
5951     'option_sub'  => sub { require FS::Record;
5952                            require FS::cdr_type;
5953                            my $cdr_type = FS::Record::qsearchs(
5954                              'cdr_type', { 'cdrtypenum'=>shift } );
5955                            $cdr_type ? $cdr_type->cdrtypename : '';
5956                          },
5957   },
5958
5959   {
5960     'key'         => 'cdr-minutes_priority',
5961     'section'     => 'telephony',
5962     'description' => 'Priority rule for assigning included minutes to CDRs.',
5963     'type'        => 'select',
5964     'select_hash' => [
5965       ''          => 'No specific order',
5966       'time'      => 'Chronological',
5967       'rate_high' => 'Highest rate first',
5968       'rate_low'  => 'Lowest rate first',
5969     ],
5970   },
5971
5972   {
5973     'key'         => 'cdr-lrn_lookup',
5974     'section'     => 'telephony',
5975     'description' => 'Look up LRNs of destination numbers for exact matching to the terminating carrier.  This feature requires a Freeside support contract for paid access to the central NPAC database; see <a href ="#support-key">support-key</a>.',
5976     'type'        => 'checkbox',
5977   },
5978   
5979   {
5980     'key'         => 'brand-agent',
5981     'section'     => 'UI',
5982     '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.',
5983     'type'        => 'select-agent',
5984   },
5985
5986   {
5987     'key'         => 'cust_class-tax_exempt',
5988     'section'     => 'billing',
5989     'description' => 'Control the tax exemption flag per customer class rather than per indivual customer.',
5990     'type'        => 'checkbox',
5991   },
5992
5993   {
5994     'key'         => 'selfservice-billing_history-line_items',
5995     'section'     => 'self-service',
5996     'description' => 'Return line item billing detail for the self-service billing_history API call.',
5997     'type'        => 'checkbox',
5998   },
5999
6000   {
6001     'key'         => 'selfservice-default_cdr_format',
6002     'section'     => 'self-service',
6003     'description' => 'Format for showing outbound CDRs in self-service.  The per-package option overrides this.',
6004     'type'        => 'select',
6005     'select_hash' => \@cdr_formats,
6006   },
6007
6008   {
6009     'key'         => 'selfservice-default_inbound_cdr_format',
6010     'section'     => 'self-service',
6011     'description' => 'Format for showing inbound CDRs in self-service.  The per-package option overrides this.  Leave blank to avoid showing these CDRs.',
6012     'type'        => 'select',
6013     'select_hash' => \@cdr_formats,
6014   },
6015
6016   {
6017     'key'         => 'selfservice-hide_cdr_price',
6018     'section'     => 'self-service',
6019     'description' => 'Don\'t show the "Price" column on CDRs in self-service.',
6020     'type'        => 'checkbox',
6021   },
6022
6023   {
6024     'key'         => 'selfservice-enable_payment_without_balance',
6025     'section'     => 'self-service',
6026     'description' => 'Allow selfservice customers to make payments even if balance is zero or below (resulting in an unapplied payment and negative balance.)',
6027     'type'        => 'checkbox',
6028   },
6029
6030   {
6031     'key'         => 'selfservice-announcement',
6032     'section'     => 'self-service',
6033     'description' => 'HTML announcement to display to all authenticated users on account overview page',
6034     'type'        => 'textarea',
6035   },
6036
6037   {
6038     'key'         => 'logout-timeout',
6039     'section'     => 'UI',
6040     'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
6041     'type'       => 'text',
6042   },
6043   
6044   {
6045     'key'         => 'spreadsheet_format',
6046     'section'     => 'UI',
6047     'description' => 'Default format for spreadsheet download.',
6048     'type'        => 'select',
6049     'select_hash' => [
6050       'XLS' => 'XLS (Excel 97/2000/XP)',
6051       'XLSX' => 'XLSX (Excel 2007+)',
6052     ],
6053   },
6054
6055   {
6056     'key'         => 'agent-email_day',
6057     'section'     => '',
6058     '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.',
6059     'type'        => 'text',
6060   },
6061
6062   {
6063     'key'         => 'report-cust_pay-select_time',
6064     'section'     => 'UI',
6065     'description' => 'Enable time selection on payment and refund reports.',
6066     'type'        => 'checkbox',
6067   },
6068
6069   {
6070     'key'         => 'default_credit_limit',
6071     'section'     => 'billing',
6072     'description' => 'Default customer credit limit',
6073     'type'        => 'text',
6074   },
6075
6076   {
6077     'key'         => 'api_shared_secret',
6078     'section'     => 'API',
6079     'description' => 'Shared secret for back-office API authentication',
6080     'type'        => 'text',
6081   },
6082
6083   {
6084     'key'         => 'xmlrpc_api',
6085     'section'     => 'API',
6086     'description' => 'Enable the back-office API XML-RPC server (on port 8008).',
6087     'type'        => 'checkbox',
6088   },
6089
6090 #  {
6091 #    'key'         => 'jsonrpc_api',
6092 #    'section'     => 'API',
6093 #    'description' => 'Enable the back-office API JSON-RPC server (on port 8081).',
6094 #    'type'        => 'checkbox',
6095 #  },
6096
6097   {
6098     'key'         => 'api_credit_reason',
6099     'section'     => 'API',
6100     'description' => 'Default reason for back-office API credits',
6101     'type'        => 'select-sub',
6102     #false laziness w/api_credit_reason
6103     'options_sub' => sub { require FS::Record;
6104                            require FS::reason;
6105                            my $type = qsearchs('reason_type', 
6106                              { class => 'R' }) 
6107                               or return ();
6108                            map { $_->reasonnum => $_->reason }
6109                                FS::Record::qsearch('reason', 
6110                                  { reason_type => $type->typenum } 
6111                                );
6112                          },
6113     'option_sub'  => sub { require FS::Record;
6114                            require FS::reason;
6115                            my $reason = FS::Record::qsearchs(
6116                              'reason', { 'reasonnum' => shift }
6117                            );
6118                            $reason ? $reason->reason : '';
6119                          },
6120   },
6121
6122   {
6123     'key'         => 'part_pkg-term_discounts',
6124     'section'     => 'billing',
6125     'description' => 'Enable the term discounts feature.  Recommended to keep turned off unless actually using - not well optimized for large installations.',
6126     'type'        => 'checkbox',
6127   },
6128
6129   {
6130     'key'         => 'prepaid-never_renew',
6131     'section'     => 'billing',
6132     'description' => 'Prepaid packages never renew.',
6133     'type'        => 'checkbox',
6134   },
6135
6136   {
6137     'key'         => 'agent-disable_counts',
6138     'section'     => 'UI',
6139     '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.',
6140     'type'        => 'checkbox',
6141   },
6142
6143   {
6144     'key'         => 'tollfree-country',
6145     'section'     => 'telephony',
6146     'description' => 'Country / region for toll-free recognition',
6147     'type'        => 'select',
6148     'select_hash' => [ ''   => 'NANPA (US/Canada)',
6149                        'AU' => 'Australia',
6150                        'NZ' => 'New Zealand',
6151                      ],
6152   },
6153
6154   {
6155     'key'         => 'old_fcc_report',
6156     'section'     => '',
6157     'description' => 'Use the old (pre-2014) FCC Form 477 report format.',
6158     'type'        => 'checkbox',
6159   },
6160
6161   {
6162     'key'         => 'cust_main-default_commercial',
6163     'section'     => 'UI',
6164     'description' => 'Default for new customers is commercial rather than residential.',
6165     'type'        => 'checkbox',
6166   },
6167
6168   {
6169     'key'         => 'default_appointment_length',
6170     'section'     => 'UI',
6171     'description' => 'Default appointment length, in minutes (30 minute granularity).',
6172     'type'        => 'text',
6173   },
6174
6175   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6176   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6177   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6178   { key => "bindprimary", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6179   { key => "bindsecondaries", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6180   { key => "bsdshellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6181   { key => "cyrus", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6182   { key => "cp_app", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6183   { key => "erpcdmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6184   { key => "icradiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6185   { key => "icradius_mysqldest", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6186   { key => "icradius_mysqlsource", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6187   { key => "icradius_secrets", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6188   { key => "maildisablecatchall", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6189   { key => "mxmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6190   { key => "nsmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6191   { key => "arecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6192   { key => "cnamerecords", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6193   { key => "nismachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6194   { key => "qmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6195   { key => "radiusmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6196   { key => "sendmailconfigpath", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6197   { key => "sendmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6198   { key => "sendmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6199   { key => "shellmachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6200   { key => "shellmachine-useradd", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6201   { key => "shellmachine-userdel", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6202   { key => "shellmachine-usermod", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6203   { key => "shellmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6204   { key => "radiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6205   { key => "textradiusprepend", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6206   { key => "username_policy", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6207   { key => "vpopmailmachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6208   { key => "vpopmailrestart", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6209   { key => "safe-part_pkg", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6210   { key => "selfservice_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6211   { key => "signup_server-quiet", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6212   { key => "signup_server-email", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6213   { key => "vonage-username", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6214   { key => "vonage-password", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6215   { key => "vonage-fromnumber", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
6216
6217   # for internal use only; test databases should declare this option and
6218   # everyone else should pretend it doesn't exist
6219   #{
6220   #  'key'         => 'no_random_ids',
6221   #  'section'     => '',
6222   #  'description' => 'Replace random identifiers in UI code with a static string, for repeatable testing. Don\'t use in production.',
6223   #  'type'        => 'checkbox',
6224   #},
6225
6226 );
6227
6228 1;
6229