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