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